home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / futils / futils~1 / man / manpages.zoo / bash.1 < prev    next >
Encoding:
Text File  |  1991-11-11  |  120.3 KB  |  3,103 lines

  1.  
  2.  
  3.  
  4. BASH(1)                   1991 July 15                    BASH(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      bash - GNU Bourne-Again SHell
  10.  
  11. SYNOPSIS
  12.      bash [options] [file]
  13.  
  14. COPYRIGHT
  15.      Copyright (C) 1989, 1991 by the Free Software Foundation,
  16.      Inc.
  17.  
  18. DESCRIPTION
  19.      Bash is an sh-compatible command language interpreter that
  20.      executes commands read from the standard input or from a
  21.      file.  Bash also incorporates useful features from the _✓K_✓o_✓r_✓n
  22.      and _✓C shells (ksh and csh).
  23.  
  24.      Bash is ultimately intended to be a faithful implementation
  25.      of the IEEE Posix Shell and Tools specification (IEEE Work-
  26.      ing Group 1003.2).
  27.  
  28. OPTIONS
  29.      In addition to the single-character shell options documented
  30.      in the description of the set builtin command, bash inter-
  31.      prets the following flags when it is invoked:
  32.  
  33.      -c _✓s_✓t_✓r_✓i_✓n_✓g If the -c flag is present, then commands are read
  34.                from _✓s_✓t_✓r_✓i_✓n_✓g.
  35.      -i        If the -i flag is present, the shell is _✓i_✓n_✓t_✓e_✓r_✓a_✓c_✓-
  36.                _✓t_✓i_✓v_✓e.
  37.      -s        If the -s flag is present, or if no arguments
  38.                remain after option processing, then commands are
  39.                read from the standard input.  This option allows
  40.                the positional parameters to be set when invoking
  41.                an interactive shell.
  42.      -         A single - signals the end of options and disables
  43.                further option processing.  Any arguments after
  44.                the - are treated as filenames and arguments.  An
  45.                argument of -- is equivalent to an argument of -.
  46.  
  47.      Bash also interprets a number of multi-character options.
  48.      These options must appear on the command line before the
  49.      single-character options to be recognized.
  50.  
  51.      -norc     Do not load the personal initialization file
  52.                ~/._✓b_✓a_✓s_✓h_✓r_✓c if the shell is interactive.  This is
  53.                the default if the shell name is sh.
  54.      -noprofile
  55.                Do not read either /_✓e_✓t_✓c/_✓p_✓r_✓o_✓f_✓i_✓l_✓e or
  56.                ~/._✓b_✓a_✓s_✓h__✓p_✓r_✓o_✓f_✓i_✓l_✓e.  By default, bash normally reads
  57.                these files when it is invoked as a login shell.
  58.      -rcfile _✓f_✓i_✓l_✓e
  59.                Execute commands from _✓f_✓i_✓l_✓e instead of the standard
  60.  
  61.  
  62.  
  63. Page 1                                                        GNU
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. BASH(1)                   1991 July 15                    BASH(1)
  71.  
  72.  
  73.  
  74.                personal initialization file ~/._✓b_✓a_✓s_✓h_✓r_✓c, if the
  75.                shell is interactive.
  76.      -version  Show the version number of this instance of bash
  77.                when starting.
  78.      -quiet    Do not be verbose when starting up (do not show
  79.                the shell version or any other information).
  80.      -login    Make bash act as if it had been invoked by
  81.                login(1).
  82.      -nobraceexpansion
  83.                Do not perform curly brace expansion a la csh.
  84.      -nolineediting
  85.                Do not use the GNU _✓r_✓e_✓a_✓d_✓l_✓i_✓n_✓e library to read com-
  86.                mand lines if interactive.
  87.  
  88. ARGUMENTS
  89.      If arguments remain after option processing, and neither the
  90.      -c nor the -s option has been supplied, the first argument
  91.      is assumed to be the name of a file containing shell com-
  92.      mands.  If bash is invoked in this fashion, $0 is set to the
  93.      name of the file, and the positional parameters are set to
  94.      the remaining arguments.  Bash reads and executes commands
  95.      from this file, then exits.
  96.  
  97. DEFINITIONS
  98.      blank
  99.           A space or tab.
  100.      word A sequence of characters considered as a single unit by
  101.           the shell.  Also known as a token.
  102.      name A _✓w_✓o_✓r_✓d consisting only of alphanumeric characters and
  103.           underscores, and beginning with an alphabetic character
  104.           or an underscore.  Also referred to as an identifier.
  105.      metacharacter
  106.           A character that, when unquoted, separates words.  One
  107.           of the following:
  108.           |  & ; ( ) < > <space> <tab>
  109.      control operator
  110.           A _✓t_✓o_✓k_✓e_✓n that performs a control function.  It is one of
  111.           the following symbols:
  112.           || & && ; ;; ( ) | <newline>
  113.  
  114. RESERVED WORDS
  115.      _✓R_✓e_✓s_✓e_✓r_✓v_✓e_✓d _✓w_✓o_✓r_✓d_✓s are words that have a special meaning to the
  116.      shell.  The following words are recognized as reserved when
  117.      unquoted and either the first word of a simple command (see
  118.      SHELL GRAMMAR below) or the third word of a case or for com-
  119.      mand:
  120.  
  121.      ! case  do done elif else esac fi for function if in then
  122.      until while { }
  123.  
  124. SHELL GRAMMAR
  125.  
  126.  
  127.  
  128.  
  129. Page 2                                                        GNU
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. BASH(1)                   1991 July 15                    BASH(1)
  137.  
  138.  
  139.  
  140.      Simple Commands
  141.  
  142.      A _✓s_✓i_✓m_✓p_✓l_✓e _✓c_✓o_✓m_✓m_✓a_✓n_✓d is a sequence of optional variable assign-
  143.      ments followed by _✓b_✓l_✓a_✓n_✓k-separated words and redirections,
  144.      and terminated by a _✓c_✓o_✓n_✓t_✓r_✓o_✓l _✓o_✓p_✓e_✓r_✓a_✓t_✓o_✓r.  The first word speci-
  145.      fies the command to be executed.  The remaining words are
  146.      passed as arguments to the invoked command.
  147.  
  148.      The return value of a _✓s_✓i_✓m_✓p_✓l_✓e _✓c_✓o_✓m_✓m_✓a_✓n_✓d is its exit status, or
  149.      128+_✓n if the command is terminated by signal _✓n.
  150.  
  151.      Pipelines
  152.  
  153.      A _✓p_✓i_✓p_✓e_✓l_✓i_✓n_✓e is a sequence of one or more commands separated
  154.      by the character |.  The format for a pipeline is:
  155.  
  156.           [ ! ] _✓c_✓o_✓m_✓m_✓a_✓n_✓d [ | _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓2 ... ]
  157.  
  158.      The standard output of _✓c_✓o_✓m_✓m_✓a_✓n_✓d is connected to the standard
  159.      input of _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓2.  This connection is performed before any
  160.      redirections specified by the command (see REDIRECTION
  161.      below).
  162.  
  163.      If the reserved word ! precedes a pipeline, the exit status
  164.      of that pipeline is the logical NOT of the exit status of
  165.      the last command.  Otherwise, the status of the pipeline is
  166.      the exit status of the last command.  The shell waits for
  167.      all commands in the pipeline to terminate before returning a
  168.      value.
  169.  
  170.      Each command in a pipeline is executed as a separate process
  171.      (i.e. in a subshell).
  172.  
  173.      Lists
  174.  
  175.      A _✓l_✓i_✓s_✓t is a sequence of one or more pipelines separated by
  176.      one of the operators ;, &, &&, or ||, and optionally ter-
  177.      minated by one of ;, &, or <newline>.
  178.  
  179.      Of these list operators, && has highest precedence.  || has
  180.      the next highest precedence, followed by ; and &, which have
  181.      equal precedence.
  182.  
  183.      If a command is terminated by the control operator &, the
  184.      shell executes the command in the _✓b_✓a_✓c_✓k_✓g_✓r_✓o_✓u_✓n_✓d in a subshell.
  185.      The shell does not wait for the command to finish.  Commands
  186.      separated by a ; are executed sequentially; the shell waits
  187.      for each command to terminate in turn.
  188.  
  189.      The control operators && and || denote AND lists and OR
  190.      lists, respectively.  An AND list has the form
  191.  
  192.  
  193.  
  194.  
  195. Page 3                                                        GNU
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. BASH(1)                   1991 July 15                    BASH(1)
  203.  
  204.  
  205.  
  206.           _✓c_✓o_✓m_✓m_✓a_✓n_✓d && _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓2
  207.  
  208.      _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓2 is executed if, and only if, _✓c_✓o_✓m_✓m_✓a_✓n_✓d returns an
  209.      exit status of zero.
  210.  
  211.      An OR list has the form
  212.  
  213.           _✓c_✓o_✓m_✓m_✓a_✓n_✓d || _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓2
  214.  
  215.      _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓2 is executed if and only if _✓c_✓o_✓m_✓m_✓a_✓n_✓d returns a non-
  216.      zero exit status.
  217.  
  218.      Compound Commands
  219.  
  220.      A _✓c_✓o_✓m_✓p_✓o_✓u_✓n_✓d _✓c_✓o_✓m_✓m_✓a_✓n_✓d is one of the following:
  221.  
  222.      (_✓l_✓i_✓s_✓t)
  223.           _✓l_✓i_✓s_✓t is executed in a subshell.  Variable assignments
  224.           and builtin commands that affect the shell's environ-
  225.           ment do not remain in effect after the command com-
  226.           pletes.
  227.  
  228.      { _✓l_✓i_✓s_✓t; }
  229.           _✓l_✓i_✓s_✓t is simply executed in the current shell environ-
  230.           ment.  This is known as a _✓g_✓r_✓o_✓u_✓p _✓c_✓o_✓m_✓m_✓a_✓n_✓d.
  231.  
  232.      for _✓n_✓a_✓m_✓e [ in _✓w_✓o_✓r_✓d ] do _✓l_✓i_✓s_✓t done
  233.           The list of words following in is expanded, generating
  234.           a list of items.  The variable _✓n_✓a_✓m_✓e is set to each ele-
  235.           ment of this list in turn, and _✓l_✓i_✓s_✓t is executed each
  236.           time.  If the in _✓w_✓o_✓r_✓d is omitted, the for command exe-
  237.           cutes _✓l_✓i_✓s_✓t once for each positional parameter that is
  238.           set (see PARAMETERS below).  The exit status is the
  239.           exit status of the last command, or zero if no commands
  240.           were executed.
  241.  
  242.      case _✓w_✓o_✓r_✓d in [ _✓p_✓a_✓t_✓t_✓e_✓r_✓n [ | _✓p_✓a_✓t_✓t_✓e_✓r_✓n ] ... ) _✓l_✓i_✓s_✓t ;; ] ... esac
  243.           A case command first expands _✓w_✓o_✓r_✓d, and tries to match
  244.           it against each _✓p_✓a_✓t_✓t_✓e_✓r_✓n in turn.  When a match is
  245.           found, the corresponding _✓l_✓i_✓s_✓t is executed.  After the
  246.           first match, no subsequent matches are attempted.  The
  247.           exit status is zero if no patterns are matches.  Other-
  248.           wise, it is the exit status of the last command exe-
  249.           cuted in _✓l_✓i_✓s_✓t.
  250.  
  251.      if _✓l_✓i_✓s_✓t then _✓l_✓i_✓s_✓t [ elif _✓l_✓i_✓s_✓t then _✓l_✓i_✓s_✓t ] ... [ else _✓l_✓i_✓s_✓t ] fi
  252.           The if _✓l_✓i_✓s_✓t is executed.  If its exit status is zero,
  253.           the then _✓l_✓i_✓s_✓t is executed.  Otherwise, each elif _✓l_✓i_✓s_✓t
  254.           is executed in turn, and if its exit status is zero,
  255.           the corresponding then _✓l_✓i_✓s_✓t is executed and the command
  256.           completes.  Otherwise, the else _✓l_✓i_✓s_✓t is executed, if
  257.           present.  The exit status is the exit status of the
  258.  
  259.  
  260.  
  261. Page 4                                                        GNU
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. BASH(1)                   1991 July 15                    BASH(1)
  269.  
  270.  
  271.  
  272.           last command executed, or zero if no condition tested
  273.           true.
  274.  
  275.      while _✓l_✓i_✓s_✓t do _✓l_✓i_✓s_✓t done
  276.      until _✓l_✓i_✓s_✓t do _✓l_✓i_✓s_✓t done
  277.           The while command continuously executes the do _✓l_✓i_✓s_✓t as
  278.           long as the last command in _✓l_✓i_✓s_✓t returns an exit status
  279.           of zero.  The until command is identical to the while
  280.           command, except that the test is negated; the do _✓l_✓i_✓s_✓t
  281.           is executed as long as the last command in _✓l_✓i_✓s_✓t returns
  282.           a non-zero exit status.  The exit status of the while
  283.           and until commands is the exit status of the last do
  284.           _✓l_✓i_✓s_✓t command executed, or zero if none was executed.
  285.  
  286.      [ function ] _✓n_✓a_✓m_✓e () { _✓l_✓i_✓s_✓t; }
  287.           This defines a function named _✓n_✓a_✓m_✓e.  The _✓b_✓o_✓d_✓y of the
  288.           function is the _✓l_✓i_✓s_✓t of commands between { and }.  This
  289.           list is executed whenever _✓n_✓a_✓m_✓e is specified as the name
  290.           of a simple command.  The exit status of a function is
  291.           the exit status of the last command executed in the
  292.           body.  (See FUNCTIONS below.)
  293.  
  294. COMMENTS
  295.      In a non-interactive shell, a word beginning with # causes
  296.      that word and all remaining characters on that line to be
  297.      ignored.
  298.  
  299. QUOTING
  300.      _✓Q_✓u_✓o_✓t_✓i_✓n_✓g is used to remove the special meaning of certain
  301.      characters or words to the shell.  Quoting can be used to
  302.      disable special treatment for special characters, to prevent
  303.      reserved words from being recognized as such, and to prevent
  304.      parameter expansion.
  305.  
  306.      Each of the _✓m_✓e_✓t_✓a_✓c_✓h_✓a_✓r_✓a_✓c_✓t_✓e_✓r_✓s listed above under DEFINITIONS
  307.      has special meaning to the shell and must be quoted if they
  308.      are to represent themselves.  There are three quoting
  309.      mechanisms: the escape character, single quotes, and double
  310.      quotes.
  311.  
  312.      A non-quoted backslash (\) is the _✓e_✓s_✓c_✓a_✓p_✓e _✓c_✓h_✓a_✓r_✓a_✓c_✓t_✓e_✓r.  It
  313.      preserves the literal value of the next character that fol-
  314.      lows, with the exception of <newline>.  If a \<newline> pair
  315.      appears, it is treated as a line continuation (that is, it
  316.      is effectively ignored), if the backslash is non-quoted.
  317.  
  318.      Enclosing characters in single quotes preserves the literal
  319.      value of each character within the quotes.  A single quote
  320.      may not occur between single quotes, even when preceded by a
  321.      backslash.
  322.  
  323.  
  324.  
  325.  
  326.  
  327. Page 5                                                        GNU
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. BASH(1)                   1991 July 15                    BASH(1)
  335.  
  336.  
  337.  
  338.      Enclosing characters in double quotes preserves the literal
  339.      value of all characters within the quotes, with the excep-
  340.      tion of $, `, and \.  The characters $ and ` retain their
  341.      special meaning within double quotes.  The backslash retains
  342.      its special meaning only when followed by one of the follow-
  343.      ing characters:  $, `, ", \, or <newline>.  A double quote
  344.      may be quoted within double quotes by preceding it with a
  345.      backslash.
  346.  
  347.      The special parameters * and @ have special meaning when in
  348.      double quotes (see PARAMETERS below).
  349.  
  350. PARAMETERS
  351.      A _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is an entity that stores values, somewhat like a
  352.      variable in a conventional programming language.  It can be
  353.      a _✓n_✓a_✓m_✓e, a number, or one of the special characters listed
  354.      below under Special Parameters.  For the shell's purposes, a
  355.      _✓v_✓a_✓r_✓i_✓a_✓b_✓l_✓e is a parameter denoted by a _✓n_✓a_✓m_✓e.
  356.  
  357.      A parameter is set if it has been assigned a value.  The
  358.      null string is a valid value.  Once a variable is set, it
  359.      may be unset only by using the unset builtin command (see
  360.      SHELL BUILTIN COMMANDS below).
  361.  
  362.      A _✓v_✓a_✓r_✓i_✓a_✓b_✓l_✓e may be assigned to by a statement of the form
  363.  
  364.           _✓n_✓a_✓m_✓e=[_✓v_✓a_✓l_✓u_✓e]
  365.  
  366.      If _✓v_✓a_✓l_✓u_✓e is not given, the variable is assigned the null
  367.      string.  All _✓v_✓a_✓l_✓u_✓e_✓s undergo tilde expansion, parameter and
  368.      variable expansion, command substitution, arithmetic expan-
  369.      sion, and quote removal.  If the variable has its -i attri-
  370.      bute set (see declare below in SHELL BUILTIN COMMANDS) then
  371.      _✓v_✓a_✓l_✓u_✓e is subject to arithmetic expansion even if the $[...]
  372.      syntax does not appear.  Word splitting is not performed,
  373.      with the exception of "$@" as explained below under Special
  374.      Parameters.  Pathname expansion is not performed.
  375.  
  376.      Positional Parameters
  377.  
  378.      A _✓p_✓o_✓s_✓i_✓t_✓i_✓o_✓n_✓a_✓l _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is a parameter denoted by one or more
  379.      digits, other than the single digit 0.  Positional parame-
  380.      ters are assigned from the shell's arguments when it is
  381.      invoked, and may be reassigned using the set builtin com-
  382.      mand.  The positional parameters are temporarily replaced
  383.      when a shell function is executed (see FUNCTIONS below).
  384.  
  385.      When a positional parameter consisting of more than a single
  386.      digit is expanded, it must be enclosed in braces (see EXPAN-
  387.      SION below).
  388.  
  389.  
  390.  
  391.  
  392.  
  393. Page 6                                                        GNU
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. BASH(1)                   1991 July 15                    BASH(1)
  401.  
  402.  
  403.  
  404.      Special Parameters
  405.  
  406.      The shell treats several parameters specially.  These param-
  407.      eters may only be referenced; assignment to them is not
  408.      allowed.
  409.      *    Expands to the positional parameters, starting from
  410.           one.  When the expansion occurs within double quotes,
  411.           it expands to a single word with the value of each
  412.           parameter separated by the first character of the IFS
  413.           special variable.  That is, ``$*'' is equivalent to
  414.           ``$1_✓c$2_✓c...'', where _✓c is the first character of the
  415.           value of the IFS variable.  If IFS is null or unset,
  416.           the parameters are separated by spaces.
  417.      @    Expands to the positional parameters, starting from
  418.           one.  When the expansion occurs within double quotes,
  419.           each parameter expands as a separate word.  That is, ``
  420.           $@'' is equivalent to ``$1'' ``$2'' ...  When there are
  421.           no positional parameters, ``$@'' and $@ expand to noth-
  422.           ing (i.e. they are removed).
  423.      #    Expands to the number of positional parameters in
  424.           decimal.
  425.      ?    Expands to the status of the most recently executed
  426.           foreground pipeline.
  427.      -    Expands to the current option flags as specified upon
  428.           invocation, by the set builtin command, or those set by
  429.           the shell itself (such as the -i flag).
  430.      $    Expands to the process ID of the shell.  In a () sub-
  431.           shell, it expands to the process ID of the current
  432.           shell, not the subshell.
  433.      !    Expands to the process ID of the most recently executed
  434.           background (asynchronous) command.
  435.      0    Expands to the name of the shell or shell script.  This
  436.           is set at shell initialization.  If bash is invoked
  437.           with a file of commands, $0 is set to the name of that
  438.           file.  Otherwise, it is set to the pathname used to
  439.           invoke bash, as given by argument zero.
  440.      _    Expands to the last argument to the previous command,
  441.           after expansion.  Also set to the full pathname of each
  442.           command executed and placed in the environment exported
  443.           to that command.
  444.  
  445.      Shell Variables
  446.  
  447.      The following variables are set by the shell:
  448.  
  449.      PPID The process ID of the shell's parent.
  450.      PWD  The current working directory as set by the cd command.
  451.      OLDPWD
  452.           The previous working directory as set by the cd com-
  453.           mand.
  454.      REPLY
  455.           Set to the line of input read by the read builtin
  456.  
  457.  
  458.  
  459. Page 7                                                        GNU
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. BASH(1)                   1991 July 15                    BASH(1)
  467.  
  468.  
  469.  
  470.           command when no arguments are supplied.
  471.      UID  Expands to the user ID of the current user.
  472.      EUID Expands to the effective user ID of the current user.
  473.      BASH Expands to the full pathname used to invoke this
  474.           instance of bash.
  475.      BASH_VERSION
  476.           Expands to the version number of this instance of bash.
  477.      SHLVL
  478.           Incremented by one each time an instance of bash is
  479.           started.
  480.      RANDOM
  481.           Each time this parameter is referenced, a random
  482.           integer is generated.  The sequence of random numbers
  483.           may be initialized by assigning a value to RANDOM.  If
  484.           RANDOM is unset, it loses its special properties, even
  485.           if it is subsequently reset.
  486.      SECONDS
  487.           Each time this parameter is referenced, the number of
  488.           seconds since shell invocation is returned.  If a value
  489.           is assigned to SECONDS, the value returned upon subse-
  490.           quent references is the number of seconds since the
  491.           assignment plus the value assigned.  If SECONDS is
  492.           unset, it loses its special properties, even if it is
  493.           subsequently reset.
  494.      LINENO
  495.           Each time this parameter is referenced, the shell sub-
  496.           stitutes a decimal number representing the current
  497.           sequential line number (starting with 1) within a
  498.           script or function.  When not in a script or function,
  499.           the value substituted is not guaranteed to be meaning-
  500.           ful.  When in a function, the value is not the number
  501.           of the source line that the command appears on (that
  502.           information has been lost by the time the function is
  503.           executed), but is an approximation of the number of
  504.           _✓s_✓i_✓m_✓p_✓l_✓e _✓c_✓o_✓m_✓m_✓a_✓n_✓d_✓s executed in the current function.  If
  505.           LINENO is unset, it loses its special properties, even
  506.           if it is subsequently reset.
  507.      OPTARG
  508.           The value of the last option argument processed by the
  509.           getopts builtin command (see SHELL BUILTIN COMMANDS
  510.           below).
  511.      OPTIND
  512.           The index of the last option processed by the getopts
  513.           builtin command (see SHELL BUILTIN COMMANDS below).
  514.  
  515.      The following variables are used by the shell.  In some
  516.      cases, bash assigns a default value to a variable; these
  517.      cases are noted below.
  518.  
  519.      IFS  The _✓I_✓n_✓t_✓e_✓r_✓n_✓a_✓l _✓F_✓i_✓e_✓l_✓d _✓S_✓e_✓p_✓a_✓r_✓a_✓t_✓o_✓r that is used for word
  520.           splitting after expansion and to split lines into words
  521.           with the read builtin command.  The default value is
  522.  
  523.  
  524.  
  525. Page 8                                                        GNU
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. BASH(1)                   1991 July 15                    BASH(1)
  533.  
  534.  
  535.  
  536.           ``<space><tab><newline>''.
  537.      PATH The search path for commands.  It is a colon-separated
  538.           list of directories in which the shell looks for com-
  539.           mands (see COMMAND EXECUTION below).  The default path
  540.           is system-dependent, and is set by the administrator
  541.           who installs bash.  A common value is
  542.           ``.:/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/etc''.
  543.           Note that in some circumstances, however, a leading `.'
  544.           in PATH can be a security hazard.
  545.      HOME The home directory of the current user; the default
  546.           argument for the cd builtin command.
  547.      CDPATH
  548.           The search path for the cd command.  This is a colon-
  549.           separated list of directories in which the shell looks
  550.           for destination directories specified by the cd com-
  551.           mand.  A sample value is ``.:~:/usr''.
  552.      ENV  If this parameter is set when bash is executing a shell
  553.           script, its value is interpreted as a filename contain-
  554.           ing commands to initialize the shell, as in ._✓b_✓a_✓s_✓h_✓r_✓c.
  555.           The value of ENV is subjected to parameter expansion,
  556.           command substitution, and arithmetic expansion before
  557.           being interpreted as a pathname.  PATH is not used to
  558.           search for the resultant pathname.
  559.      MAIL If this parameter is set to a filename and the MAILPATH
  560.           variable is not set, bash informs the user of the
  561.           arrival of mail in the specified file.
  562.      MAILCHECK
  563.           Specifies how often (in seconds) bash checks for mail.
  564.           The default is 60 seconds.  When it is time to check
  565.           for mail, the shell does so before prompting.  If this
  566.           variable is unset, the shell disables mail checking.
  567.      MAILPATH
  568.           A colon-separated list of pathnames to be checked for
  569.           mail. The message to be printed may be specified by
  570.           separating the pathname from the message with a `?'.
  571.           $_ stands for the name of the current mailfile. Exam-
  572.           ple:
  573.           MAILPATH='/usr/spool/mail/bfox?"You have
  574.           mail":~/shell-mail?"$_ has mail!"'
  575.           Bash supplies a default value for this variable, but
  576.           the location of the user mail files that it uses is
  577.           system dependent (e.g. /usr/spool/mail/$USER).
  578.      MAIL_WARNING
  579.           If set, and a file that bash is checking for mail has
  580.           been accessed since the last time it was checked, the
  581.           message ``The mail in` _✓m_✓a_✓i_✓l_✓f_✓i_✓l_✓e has been read'' is
  582.           printed.
  583.      PS1  The value of this parameter is expanded (see PROMPTING
  584.           below) and used as the primary prompt string.  The
  585.           default value is ``bash\$ ''.
  586.      PS2  The value of this parameter is expanded like PS1 and
  587.           used as the secondary prompt string.  The default is
  588.  
  589.  
  590.  
  591. Page 9                                                        GNU
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. BASH(1)                   1991 July 15                    BASH(1)
  599.  
  600.  
  601.  
  602.           ``bash> ''.
  603.      PS4  The value of this parameter is expanded like PS1 and
  604.           the value is printed before each command bash displays
  605.           during an execution trace.  The first character of PS4
  606.           is replicated multiple times, as necessary, to indicate
  607.           multiple levels of indirection.  The default is ``+ ''.
  608.      NO_PROMPT_VARS
  609.           If set, the decoded prompt string does not undergo
  610.           further expansion (see PROMPTING below).
  611.      HISTSIZE
  612.           The number of commands to remember in the command his-
  613.           tory (see HISTORY below).
  614.      HISTFILE
  615.           The name of the file in which command history is saved.
  616.           (See HISTORY below.)
  617.      HISTFILESIZE
  618.           The maximum number of lines contained in the history
  619.           file.  When this variable is assigned a value, the his-
  620.           tory file is truncated, if necessary, to contain no
  621.           more than that number of lines.
  622.      OPTERR
  623.           If set to the value 1, bash displays error messages
  624.           generated by the getopts builtin command (see SHELL
  625.           BUILTIN COMMANDS below).  OPTERR is initialized to 1
  626.           each time the shell is invoked or a shell script is
  627.           executed.
  628.      PROMPT_COMMAND
  629.           If set, the value is executed as a command prior to
  630.           issuing each primary prompt.
  631.      IGNOREEOF
  632.      ignoreeof
  633.           Controls the action of the shell on receipt of an EOF
  634.           character as the sole input.  If set, the value is the
  635.           number of consecutive EOF characters typed before bash
  636.           exits.  If the variable exists but does not have a
  637.           numeric value, or has no value, the default value is
  638.           10.  If it does not exist, EOF signifies the end of
  639.           input to the shell.  This is only in effect for
  640.           interactive shells.
  641.      HOSTTYPE
  642.           Automatically set to a string that uniquely describes
  643.           the type of machine on which bash is executing.  The
  644.           default is system-dependent.
  645.      TMOUT
  646.           If set to a value greater than zero, the value is
  647.           interpreted as the number of seconds to wait for input
  648.           after issuing the primary prompt.  Bash terminates
  649.           after waiting for that number of seconds if input does
  650.           not arrive.
  651.      FCEDIT
  652.           The default editor for the fc builtin command.
  653.      FIGNORE
  654.  
  655.  
  656.  
  657. Page 10                                                       GNU
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. BASH(1)                   1991 July 15                    BASH(1)
  665.  
  666.  
  667.  
  668.           A colon-separated list of suffixes to ignore when per-
  669.           forming filename completion (see READLINE below).  A
  670.           filename whose suffix matches one of the entries in
  671.           FIGNORE is excluded from the list of matched filenames.
  672.           A sample value is ``.o:~''.
  673.      notify
  674.           If set, bash reports terminated background jobs immedi-
  675.           ately, rather than waiting until before printing the
  676.           next primary prompt.
  677.      history_control
  678.           If set to a value of _✓i_✓g_✓n_✓o_✓r_✓e_✓s_✓p_✓a_✓c_✓e, it means don't enter
  679.           lines which begin with a <space> on the history list.
  680.           If set to a value of _✓i_✓g_✓n_✓o_✓r_✓e_✓d_✓u_✓p_✓s, it means don't enter
  681.           lines which match the last entered line.  If unset, or
  682.           if set to any other value than those above, all lines
  683.           read by the parser are saved on the history list.
  684.      glob_dot_filenames
  685.           If set, bash includes filenames beginning with a `.' in
  686.           the results of pathname expansion.
  687.      allow_null_glob_expansion
  688.           If set, bash allows pathname patterns which match no
  689.           files (see Pathname Expansion below) to expand to a
  690.           null string, rather than themselves.
  691.      histchars
  692.           The two characters which control history expansion and
  693.           tokenization.  The first character is the _✓h_✓i_✓s_✓t_✓o_✓r_✓y
  694.           _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n _✓c_✓h_✓a_✓r_✓a_✓c_✓t_✓e_✓r, that is, the character which sig-
  695.           nals the start of a history expansion, normally `!'.
  696.           The second character is the character which signifies
  697.           that the remainder of the line is a comment, when found
  698.           as the first character of a word.
  699.      nolinks
  700.           If set, the shell does not follow symbolic links when
  701.           executing commands that change the current working
  702.           directory.  It uses the physical directory structure
  703.           instead.  By default, bash follows the logical chain of
  704.           directories when performing commands such as cd.
  705.      hostname_completion_file
  706.           Contains the name of a file in the same format as
  707.           /_✓e_✓t_✓c/_✓h_✓o_✓s_✓t_✓s that should be read when the shell needs to
  708.           complete a hostname.  You can change the file interac-
  709.           tively; the next time you want to complete a hostname
  710.           bash adds the contents of the new file to the already
  711.           existing database.
  712.      noclobber
  713.           If set, bash does not overwrite an existing file with
  714.           the >, >&, and <> redirection operators.  This variable
  715.           may be overridden when creating output files by using
  716.           the redirection operator >| instead of > (see also the
  717.           -C option to the set builtin command).
  718.      auto_resume
  719.           This variable controls how the shell interacts with the
  720.  
  721.  
  722.  
  723. Page 11                                                       GNU
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. BASH(1)                   1991 July 15                    BASH(1)
  731.  
  732.  
  733.  
  734.           user and job control.  If this variable is set, single
  735.           word simple commands without redirections are treated
  736.           as candidates for resumption of an existing stopped
  737.           job.  There is no ambiguity allowed; if there is more
  738.           than one job beginning with the string typed, the job
  739.           most recently accessed is selected.
  740.      no_exit_on_failed_exec
  741.           If this variable exists, the shell does not exit if it
  742.           cannot execute the file specified in the exec command.
  743.      cdable_vars
  744.           If this is set, an argument to the cd builtin command
  745.           that is not a directory is assumed to be the name of a
  746.           variable whose value is the directory to change to.
  747.      pushd_silent
  748.           If set, the pushd and popd builtin commands do not
  749.           print the current directory stack after successful exe-
  750.           cution.
  751.  
  752. EXPANSION
  753.      Expansion is performed on the command line after it has been
  754.      split into words.  There are seven kinds of expansion per-
  755.      formed:  _✓b_✓r_✓a_✓c_✓e _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n, _✓t_✓i_✓l_✓d_✓e _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n, _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r _✓a_✓n_✓d
  756.      _✓v_✓a_✓r_✓i_✓a_✓b_✓l_✓e _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n, _✓c_✓o_✓m_✓m_✓a_✓n_✓d _✓s_✓u_✓b_✓s_✓t_✓i_✓t_✓u_✓t_✓i_✓o_✓n, _✓a_✓r_✓i_✓t_✓h_✓m_✓e_✓t_✓i_✓c _✓e_✓x_✓p_✓a_✓n_✓-
  757.      _✓s_✓i_✓o_✓n, _✓w_✓o_✓r_✓d _✓s_✓p_✓l_✓i_✓t_✓t_✓i_✓n_✓g, and _✓p_✓a_✓t_✓h_✓n_✓a_✓m_✓e _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n.
  758.  
  759.      Only brace expansion, word splitting, and pathname expansion
  760.      can change the number of words of the expansion; other
  761.      expansions expand a single word to a single word.  The sin-
  762.      gle exception to this is the expansion of ``$@'' as
  763.      explained above (see PARAMETERS).
  764.  
  765.      Brace Expansion
  766.  
  767.      _✓B_✓r_✓a_✓c_✓e _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n is a mechanism by which arbitrary strings
  768.      may be generated.  This mechanism is similar to _✓p_✓a_✓t_✓h_✓n_✓a_✓m_✓e
  769.      _✓e_✓x_✓p_✓a_✓n_✓s_✓i_✓o_✓n, but the filenames generated need not exist.  Pat-
  770.      terns to be brace expanded take the form of an optional
  771.      _✓p_✓r_✓e_✓a_✓m_✓b_✓l_✓e, followed by a series of comma-separated strings
  772.      between a pair of braces, followed by an optional _✓p_✓o_✓s_✓t_✓a_✓m_✓b_✓l_✓e.
  773.      The preamble is prepended to each string contained within
  774.      the braces, and the postamble is then appended to each
  775.      resulting string, expanding left to right.
  776.  
  777.      Brace expansions may be nested.  The results of each
  778.      expanded string are not sorted; left to right order is
  779.      preserved.  For example, a{d,c,b}e expands into `ade ace
  780.      abe'.
  781.  
  782.      Brace expansion is performed before any other expansions,
  783.      and any characters special to other expansions are preserved
  784.      in the result.
  785.  
  786.  
  787.  
  788.  
  789. Page 12                                                       GNU
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. BASH(1)                   1991 July 15                    BASH(1)
  797.  
  798.  
  799.  
  800.      This construct is typically used as shorthand when the com-
  801.      mon prefix of the strings to be generated is longer than in
  802.      the above example:
  803.  
  804.           mkdir /usr/local/src/bash/{old,new,dist,bugs}
  805.      or
  806.           chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
  807.  
  808.      Brace expansion introduces a slight incompatibility with
  809.      traditional versions of sh, the Bourne shell.  sh does not
  810.      treat opening or closing braces specially when they appear
  811.      as part of a word, and preserves them in the output.  Bash
  812.      removes braces from words as a consequence of brace expan-
  813.      sion.  For example, a word entered to sh as _✓f_✓i_✓l_✓e{_✓1,_✓2}
  814.      appears identically in the output.  The same word is output
  815.      as _✓f_✓i_✓l_✓e_✓1 _✓f_✓i_✓l_✓e_✓2 after expansion by bash.  If strict compati-
  816.      bility with sh is desired, start bash with the -nobraceex-
  817.      pansion flag (see OPTIONS above) or disable brace expansion
  818.      with the +o braceexpand option to the set command (see SHELL
  819.      BUILTIN COMMANDS below).
  820.  
  821.      Tilde Expansion
  822.  
  823.      If a word begins with a tilde character (`~'), all of the
  824.      characters preceding the first slash (or all characters, if
  825.      there is no slash) are treated as a possible _✓l_✓o_✓g_✓i_✓n _✓n_✓a_✓m_✓e. If
  826.      this _✓l_✓o_✓g_✓i_✓n _✓n_✓a_✓m_✓e is the null string, the tilde is replaced
  827.      with the value of the parameter HOME.  If HOME is unset, the
  828.      home directory of the user executing the shell is substi-
  829.      tuted instead.
  830.  
  831.      If a `+' follows the tilde, the value of PWD is substituted.
  832.      If a `-' follows, the value of OLDPWD is used.
  833.  
  834.      Additionally, each word is checked for unquoted instances of
  835.      tildes following a : or =.  In these cases, tilde substitu-
  836.      tion is also performed.  Consequently, one may use pathnames
  837.      with tildes in PATH, MAILPATH, and CDPATH.
  838.  
  839.      Parameter Expansion
  840.  
  841.      The `$' character introduces parameter expansion, command
  842.      substitution, or arithmetic expansion.  The parameter name
  843.      or symbol to be expanded may be enclosed in braces, which
  844.      are optional but serve to protect the variable to be
  845.      expanded from characters immediately following it which
  846.      could be interpreted as part of the name.
  847.  
  848.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r}
  849.           The value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is substituted.  The braces are
  850.           required when _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is a positional parameter with
  851.           more than one digit, or when _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is followed by a
  852.  
  853.  
  854.  
  855. Page 13                                                       GNU
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. BASH(1)                   1991 July 15                    BASH(1)
  863.  
  864.  
  865.  
  866.           character which is not to be interpreted as part of its
  867.           name.
  868.  
  869.      In each of the cases below, _✓w_✓o_✓r_✓d is subject to tilde expan-
  870.      sion, parameter expansion, command substitution, and arith-
  871.      metic expansion.  Bash tests for a parameter that is unset
  872.      or null; omitting the colon results in a test only for a
  873.      parameter that is unset.
  874.  
  875.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r:-_✓w_✓o_✓r_✓d}
  876.           Use Default Values.  If _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is unset or null, the
  877.           expansion of _✓w_✓o_✓r_✓d is substituted.  Otherwise, the value
  878.           of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is substituted.
  879.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r:=_✓w_✓o_✓r_✓d}
  880.           Assign Default Values.  If _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is unset or null,
  881.           the expansion of _✓w_✓o_✓r_✓d is assigned to _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r.  The
  882.           value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is then substituted.  Positional
  883.           parameters and special parameters may not be assigned
  884.           to in this way.
  885.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r:?_✓w_✓o_✓r_✓d}
  886.           Display Error if Null or Unset.  If _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is null
  887.           or unset, the expansion of _✓w_✓o_✓r_✓d (or a message to that
  888.           effect if _✓w_✓o_✓r_✓d is not present) is written to the stan-
  889.           dard error and the shell, if it is not interactive,
  890.           exits.  Otherwise, the value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is substi-
  891.           tuted.
  892.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r:+_✓w_✓o_✓r_✓d}
  893.           Use Alternate Value.  If _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is null or unset,
  894.           nothing is substituted, otherwise the expansion of _✓w_✓o_✓r_✓d
  895.           is substituted.
  896.      ${#_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r}
  897.           The length in characters of the value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is
  898.           substituted.  If _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r is * or @, the length sub-
  899.           stituted is the length of * expanded within double
  900.           quotes.
  901.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r#_✓w_✓o_✓r_✓d}
  902.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r##_✓w_✓o_✓r_✓d}
  903.           The _✓w_✓o_✓r_✓d is expanded to produce a pattern just as in
  904.           pathname expansion.  If the pattern matches the begin-
  905.           ning of the value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r, then the expansion is
  906.           the value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r with the shortest matching pat-
  907.           tern deleted (the ``#'' case) or the longest matching
  908.           pattern deleted (the ``##'' case).
  909.  
  910.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r%_✓w_✓o_✓r_✓d}
  911.      ${_✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r%%_✓w_✓o_✓r_✓d}
  912.           The _✓w_✓o_✓r_✓d is expanded to produce a pattern just as in
  913.           pathname expansion.  If the pattern matches a trailing
  914.           portion of the value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r, then the expansion
  915.           is the value of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r with the shortest matching
  916.           pattern deleted (the ``%'' case) or the longest match-
  917.           ing pattern deleted (the ``%%'' case).
  918.  
  919.  
  920.  
  921. Page 14                                                       GNU
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. BASH(1)                   1991 July 15                    BASH(1)
  929.  
  930.  
  931.  
  932.      Command Substitution
  933.  
  934.      _✓C_✓o_✓m_✓m_✓a_✓n_✓d _✓s_✓u_✓b_✓s_✓t_✓i_✓t_✓u_✓t_✓i_✓o_✓n allows the output of a command to
  935.      replace the command name.  There are two forms:
  936.  
  937.           $(_✓c_✓o_✓m_✓m_✓a_✓n_✓d)
  938.      or
  939.           `_✓c_✓o_✓m_✓m_✓a_✓n_✓d`
  940.  
  941.      Bash performs the expansion by executing _✓c_✓o_✓m_✓m_✓a_✓n_✓d and replac-
  942.      ing the command substitution with the standard output of the
  943.      command, with any trailing newlines deleted.
  944.  
  945.      When the old-style backquote form of substitution is used,
  946.      backslash retains its literal meaning except when followed
  947.      by $, `, or \.  When using the $(_✓c_✓o_✓m_✓m_✓a_✓n_✓d) form, all charac-
  948.      ters between the parentheses make up the command; none are
  949.      treated specially.
  950.  
  951.      Command substitutions may be nested.  To nest when using the
  952.      old form, escape the inner backquotes with backslashes.
  953.  
  954.      If the substitution appears within double quotes, word
  955.      splitting and pathname expansion are not performed on the
  956.      results.
  957.  
  958.      Arithmetic Expansion
  959.  
  960.      Arithmetic expansion allows the evaluation of an arithmetic
  961.      expression and the substitution of the result.  The format
  962.      for arithmetic expansion is:
  963.  
  964.           $[_✓e_✓x_✓p_✓r_✓e_✓s_✓s_✓i_✓o_✓n]
  965.  
  966.      The _✓e_✓x_✓p_✓r_✓e_✓s_✓s_✓i_✓o_✓n is treated as if it were within double
  967.      quotes, but a double quote inside the braces is not treated
  968.      specially.  All tokens in the expression undergo parameter
  969.      expansion, command substitution, and quote removal.  Arith-
  970.      metic substitutions may be nested.
  971.  
  972.      The evaluation is performed according to the rules listed
  973.      below under ARITHMETIC EVALUATION.  If _✓e_✓x_✓p_✓r_✓e_✓s_✓s_✓i_✓o_✓n is
  974.      invalid, bash prints a message indicating failure and no
  975.      substitution occurs.
  976.  
  977.      Word Splitting
  978.  
  979.      The shell scans the results of parameter expansion, command
  980.      substitution, and arithmetic expansion that did not occur
  981.      within double quotes for _✓w_✓o_✓r_✓d _✓s_✓p_✓l_✓i_✓t_✓t_✓i_✓n_✓g.
  982.  
  983.  
  984.  
  985.  
  986.  
  987. Page 15                                                       GNU
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. BASH(1)                   1991 July 15                    BASH(1)
  995.  
  996.  
  997.  
  998.      The shell treats each character of IFS as a delimiter, and
  999.      splits the results of the other expansions into words on
  1000.      these characters.  If the value of IFS is exactly
  1001.      <space><tab><newline>, the default, then any sequence of IFS
  1002.      characters serves to delimit words; otherwise each
  1003.      occurrence of an IFS character is treated as a delimiter.
  1004.      If the value of IFS is null, no word splitting occurs.  IFS
  1005.      cannot be unset.
  1006.  
  1007.      Explicit null arguments ("" or '') are retained.  Implicit
  1008.      null arguments, resulting from the expansion of _✓p_✓a_✓r_✓a_✓m_✓e_✓t_✓e_✓r_✓s
  1009.      that have no values, are removed.
  1010.  
  1011.      Note that if no expansion occurs, no splitting is performed.
  1012.  
  1013.      Pathname Expansion
  1014.  
  1015.      After word splitting, bash scans each _✓w_✓o_✓r_✓d for the charac-
  1016.      ters *, ?, and [, unless the -f flag has been set.  If one
  1017.      of these characters appears, then the word is regarded as a
  1018.      _✓p_✓a_✓t_✓t_✓e_✓r_✓n, and replaced with an alphabetically sorted list of
  1019.      pathnames matching the pattern.  If no matching pathnames
  1020.      are found, and the shell variable allow_null_glob_expansion
  1021.      is unset, the word is left unchanged.  If the variable is
  1022.      set, the word is removed if no matches are found.  When a
  1023.      pattern is used for pathname generation, the character ``.''
  1024.      at the start of a name or immediately following a slash must
  1025.      be matched explicitly, unless the shell variable
  1026.      glob_dot_filenames is set.  The slash character must always
  1027.      be matched explicitly.  In other cases, the ``.'' character
  1028.      is not treated specially.
  1029.  
  1030.      The special pattern characters have the following meanings:
  1031.  
  1032.      *    Matches any string, including the null string.
  1033.      ?    Matches any single character.
  1034.      [...]
  1035.           Matches any one of the enclosed characters.  A pair of
  1036.           characters separated by a minus sign denotes a _✓r_✓a_✓n_✓g_✓e;
  1037.           any character lexically between those two characters,
  1038.           inclusive, is matched.  If the first character follow-
  1039.           ing the [ is a ! or a ^ then any character not enclosed
  1040.           is matched.  A - or ] may be matched by including it as
  1041.           the first or last character in the set.
  1042.  
  1043.      Quote Removal
  1044.  
  1045.      After the preceding expansions, all unquoted occurrences of
  1046.      the characters \, `, and " are removed.
  1047.  
  1048. REDIRECTION
  1049.      Before a command is executed, its input and output may be
  1050.  
  1051.  
  1052.  
  1053. Page 16                                                       GNU
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. BASH(1)                   1991 July 15                    BASH(1)
  1061.  
  1062.  
  1063.  
  1064.      _✓r_✓e_✓d_✓i_✓r_✓e_✓c_✓t_✓e_✓d using a special notation interpreted by the
  1065.      shell.  Redirection may also be used to open and close files
  1066.      for the current shell execution environment.  The following
  1067.      redirection operators may appear anywhere in a _✓s_✓i_✓m_✓p_✓l_✓e _✓c_✓o_✓m_✓-
  1068.      _✓m_✓a_✓n_✓d or may precede or follow a _✓c_✓o_✓m_✓m_✓a_✓n_✓d.  Redirections are
  1069.      processed in the order they appear, from left to right.
  1070.  
  1071.      In the following descriptions, if the file descriptor number
  1072.      is omitted, and the first character of the redirection
  1073.      operator is <, the redirection refers to the standard input
  1074.      (file descriptor 0).  If the first character of the redirec-
  1075.      tion operator is >, the redirection refers to the standard
  1076.      output (file descriptor 1).
  1077.  
  1078.      The word that follows the redirection operator in the fol-
  1079.      lowing descriptions is subjected to brace expansion, tilde
  1080.      expansion, parameter expansion, command substitution, arith-
  1081.      metic expansion, quote removal, and pathname expansion.  If
  1082.      it expands to more than one word, bash reports an error.
  1083.  
  1084.      Redirecting Input
  1085.  
  1086.      Redirection of input causes the file whose name results from
  1087.      the expansion of _✓w_✓o_✓r_✓d to be opened for reading on file
  1088.      descriptor _✓n, or the standard input (file descriptor 0) if _✓n
  1089.      is not specified.
  1090.  
  1091.      The general format for redirecting input is:
  1092.  
  1093.           [_✓n]<_✓w_✓o_✓r_✓d
  1094.  
  1095.      Redirecting Output
  1096.  
  1097.      Redirection of output causes the file whose name results
  1098.      from the expansion of _✓w_✓o_✓r_✓d to be opened for writing on file
  1099.      descriptor _✓n, or the standard output (file descriptor 1) if
  1100.      _✓n is not specified.  If the file does not exist it is
  1101.      created; if it does exist it is truncated to zero size.
  1102.  
  1103.      The general format for redirecting output is:
  1104.  
  1105.           [_✓n]>_✓w_✓o_✓r_✓d
  1106.  
  1107.      If the redirection operator is >|, then the variable
  1108.      noclobber is not consulted, and the file is created regard-
  1109.      less of the value of noclobber (see Shell Variables above).
  1110.  
  1111.      Appending Redirected Output
  1112.  
  1113.      Redirection of output in this fashion causes the file whose
  1114.      name results from the expansion of _✓w_✓o_✓r_✓d to be opened for
  1115.      appending on file descriptor _✓n, or the standard output (file
  1116.  
  1117.  
  1118.  
  1119. Page 17                                                       GNU
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. BASH(1)                   1991 July 15                    BASH(1)
  1127.  
  1128.  
  1129.  
  1130.      descriptor 1) if _✓n is not specified.  If the file does not
  1131.      exist it is created.
  1132.  
  1133.      The general format for appending output is:
  1134.  
  1135.           [_✓n]>>_✓w_✓o_✓r_✓d
  1136.  
  1137.      Redirecting Standard Output and Standard Error
  1138.  
  1139.      Bash allows both the standard output (file descriptor 1) and
  1140.      the standard error output (file descriptor 2) to be
  1141.      redirected to the file whose name is the expansion of _✓w_✓o_✓r_✓d
  1142.      with this construct.
  1143.  
  1144.      There are two formats for redirecting standard output and
  1145.      standard error:
  1146.  
  1147.           &>_✓w_✓o_✓r_✓d
  1148.      and
  1149.           >&_✓w_✓o_✓r_✓d
  1150.  
  1151.      Of the two forms, the first is preferred.  This is semanti-
  1152.      cally equivalent to
  1153.  
  1154.           >_✓w_✓o_✓r_✓d 2>&1
  1155.  
  1156.      Here Documents
  1157.  
  1158.      This type of redirection instructs the shell to read input
  1159.      from the current source until a line containing only _✓w_✓o_✓r_✓d
  1160.      (with no trailing blanks) is seen.  All of the lines read up
  1161.      to that point are then used as the standard input for a com-
  1162.      mand.
  1163.  
  1164.      The format of here-documents is as follows:
  1165.  
  1166.           <<[-]_✓w_✓o_✓r_✓d
  1167.                   _✓h_✓e_✓r_✓e-_✓d_✓o_✓c_✓u_✓m_✓e_✓n_✓t
  1168.           _✓d_✓e_✓l_✓i_✓m_✓i_✓t_✓e_✓r
  1169.  
  1170.      No parameter expansion, command substitution, pathname
  1171.      expansion, or arithmetic expansion is performed on _✓w_✓o_✓r_✓d.  If
  1172.      any characters in _✓w_✓o_✓r_✓d are quoted, the _✓d_✓e_✓l_✓i_✓m_✓i_✓t_✓e_✓r is the
  1173.      result of quote removal on _✓w_✓o_✓r_✓d, and the lines in the here-
  1174.      document are not expanded.  Otherwise, all lines of the
  1175.      here-document are subjected to parameter expansion, command
  1176.      substitution, and arithmetic expansion.  In the latter case,
  1177.      the pair \<newline> is ignored, and \ must be used to quote
  1178.      the characters \, $, and `.
  1179.  
  1180.      If the redirection operator is <<-, then all leading tab
  1181.      characters are stripped from input lines and the line
  1182.  
  1183.  
  1184.  
  1185. Page 18                                                       GNU
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. BASH(1)                   1991 July 15                    BASH(1)
  1193.  
  1194.  
  1195.  
  1196.      containing _✓d_✓e_✓l_✓i_✓m_✓i_✓t_✓e_✓r.  This allows here-documents within
  1197.      shell scripts to be indented in a natural fashion.
  1198.  
  1199.      Duplicating File Descriptors
  1200.  
  1201.      The redirection operator
  1202.  
  1203.           [_✓n]<&_✓w_✓o_✓r_✓d
  1204.  
  1205.      is used to duplicate input file descriptors.  If _✓w_✓o_✓r_✓d
  1206.      expands to one or more digits, the file descriptor denoted
  1207.      by _✓n is made to be a copy of that file descriptor.  If _✓w_✓o_✓r_✓d
  1208.      evaluates to -, file descriptor _✓n is closed.  If _✓n is not
  1209.      specified, the standard input (file descriptor 0) is used.
  1210.  
  1211.      The operator
  1212.  
  1213.           [_✓n]>&_✓w_✓o_✓r_✓d
  1214.  
  1215.      is used similarly to duplicate output file descriptors.  If
  1216.      _✓n is not specified, the standard output (file descriptor 1)
  1217.      is used.
  1218.  
  1219.      Opening File Descriptors for Reading and Writing
  1220.  
  1221.      The redirection operator
  1222.  
  1223.           [_✓n]<>_✓w_✓o_✓r_✓d
  1224.  
  1225.      causes the file whose name is the expansion of _✓w_✓o_✓r_✓d to be
  1226.      opened for both reading and writing on file descriptor _✓n, or
  1227.      as the standard input and standard output if _✓n is not speci-
  1228.      fied.
  1229.  
  1230.      Note that the order of redirections is significant.  For
  1231.      example, the command
  1232.  
  1233.           ls > dirlist 2>&1
  1234.  
  1235.      directs both standard output and standard error to the file
  1236.      _✓d_✓i_✓r_✓l_✓i_✓s_✓t, while the command
  1237.  
  1238.           ls 2>&1 > dirlist
  1239.  
  1240.      directs only the standard output to file _✓d_✓i_✓r_✓l_✓i_✓s_✓t, because
  1241.      the standard error was duplicated as standard output before
  1242.      the standard output was redirected to _✓d_✓i_✓r_✓l_✓i_✓s_✓t.
  1243.  
  1244. FUNCTIONS
  1245.      A shell function, defined as described above under SHELL
  1246.      GRAMMAR, stores a series of commands for later execution.
  1247.      However, functions are executed in the context of the
  1248.  
  1249.  
  1250.  
  1251. Page 19                                                       GNU
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. BASH(1)                   1991 July 15                    BASH(1)
  1259.  
  1260.  
  1261.  
  1262.      current shell; no new process is created to interpret them
  1263.      (contrast this with the execution of a shell script).  When
  1264.      a function is executed, the arguments to the function become
  1265.      the positional parameters during its execution.  The special
  1266.      parameter # is updated to reflect the change.  Positional
  1267.      parameter 0 is unchanged.
  1268.  
  1269.      Variables local to the function may be declared with the
  1270.      local builtin command.  Ordinarily, variables and their
  1271.      values are shared between the function and its caller.
  1272.  
  1273.      If the builtin command return is executed in a function, the
  1274.      function completes and execution resumes with the next com-
  1275.      mand after the function call.  When a function completes,
  1276.      the values of the positional parameters and the special
  1277.      parameter # are restored to the values they had prior to
  1278.      function execution.
  1279.  
  1280.      Function names may be listed with the -f option to the
  1281.      declare or typeset builtin commands.  Functions may be
  1282.      exported so that subshells automatically have them defined
  1283.      with the -f option to the export builtin.
  1284.  
  1285.      Functions may be recursive.  No limit is imposed on the
  1286.      number of recursive calls.
  1287.  
  1288. ALIASES
  1289.      The shell maintains a list of _✓a_✓l_✓i_✓a_✓s_✓e_✓s that may be set and
  1290.      unset with the alias and unalias builtin commands.  The
  1291.      first word of each command is checked to see if it has an
  1292.      alias.  If so, that word is replaced by the text of the
  1293.      alias.  The alias name and the replacement text may contain
  1294.      any valid shell input, including the _✓m_✓e_✓t_✓a_✓c_✓h_✓a_✓r_✓a_✓c_✓t_✓e_✓r_✓s listed
  1295.      above.  The first word of the replacement text is tested for
  1296.      aliases, but a word that is identical to an alias being
  1297.      expanded is not expanded a second time.  This means that one
  1298.      may alias ls to ls -F, for instance, and bash does not try
  1299.      to recursively expand the replacement text.  If the last
  1300.      character of the alias value is a _✓b_✓l_✓a_✓n_✓k, then the next com-
  1301.      mand word following the alias is also checked for alias
  1302.      expansion.
  1303.  
  1304.      Aliases are created and listed with the alias command, and
  1305.      removed with the unalias command.
  1306.  
  1307.      There is no mechanism for using arguments in the replacement
  1308.      text, a la csh.  If arguments are needed, a shell function
  1309.      should be used.
  1310.  
  1311.      The rules concerning the definition and use of aliases are
  1312.      somewhat confusing.  Bash always reads at least one complete
  1313.      line of input before executing any of the commands on that
  1314.  
  1315.  
  1316.  
  1317. Page 20                                                       GNU
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. BASH(1)                   1991 July 15                    BASH(1)
  1325.  
  1326.  
  1327.  
  1328.      line.  Aliases are expanded when a command is read, not when
  1329.      it is executed.  Therefore, an alias definition appearing on
  1330.      the same line as another command does not take effect until
  1331.      the next line of input is read.  This means that the com-
  1332.      mands following the alias definition on that line are not
  1333.      affected by the new alias.  This behavior is also an issue
  1334.      when functions are executed.  Aliases are expanded when the
  1335.      function definition is read, not when the function is exe-
  1336.      cuted, because a function definition is itself a compound
  1337.      command.  As a consequence, aliases defined in a function
  1338.      are not available until after that function is executed.  To
  1339.      be safe, always put alias definitions on a separate line,
  1340.      and do not use alias in compound commands.
  1341.  
  1342.      Aliases are not expanded when the shell is not interactive.
  1343.  
  1344.      Note that for almost every purpose, aliases are superseded
  1345.      by shell functions.
  1346.  
  1347. JOB CONTROL
  1348.      _✓J_✓o_✓b _✓c_✓o_✓n_✓t_✓r_✓o_✓l refers to the ability to selectively stop
  1349.      (_✓s_✓u_✓s_✓p_✓e_✓n_✓d) the execution of processes and continue (_✓r_✓e_✓s_✓u_✓m_✓e)
  1350.      their execution at a later point.  A user typically employs
  1351.      this facility via an interactive interface supplied jointly
  1352.      by the system's terminal driver and bash.
  1353.  
  1354.      The shell associates a _✓j_✓o_✓b with each pipeline.  It keeps a
  1355.      table of currently executing jobs, which may be listed with
  1356.      the jobs command.  When bash starts a job asynchronously (in
  1357.      the _✓b_✓a_✓c_✓k_✓g_✓r_✓o_✓u_✓n_✓d), it prints a line that looks like:
  1358.  
  1359.           [1] 25647
  1360.  
  1361.      indicating that this job is job number 1 and that the pro-
  1362.      cess ID of the single process in the job is 25647.  Bash
  1363.      uses the _✓j_✓o_✓b abstraction as the basis for job control.
  1364.  
  1365.      To facilitate the implementation of the user interface to
  1366.      job control, the system maintains the notion of a _✓c_✓u_✓r_✓r_✓e_✓n_✓t
  1367.      _✓t_✓e_✓r_✓m_✓i_✓n_✓a_✓l _✓p_✓r_✓o_✓c_✓e_✓s_✓s _✓g_✓r_✓o_✓u_✓p _✓I_✓D.  Members of this process group
  1368.      (processes whose process group ID is equal to the current
  1369.      terminal process group ID) receive keyboard-generated sig-
  1370.      nals such as SIGINT.  These processes are said to be in the
  1371.      _✓f_✓o_✓r_✓e_✓g_✓r_✓o_✓u_✓n_✓d.  _✓B_✓a_✓c_✓k_✓g_✓r_✓o_✓u_✓n_✓d processes are those whose process
  1372.      group ID differs from the terminal's; such processes are
  1373.      immune to keyboard-generated signals.  Only foreground
  1374.      processes are allowed to read from or write to the terminal.
  1375.      Background processes which attempt to read from (write to)
  1376.      the terminal are sent a SIGTTIN (SIGTTOU) signal by the ter-
  1377.      minal driver, which, unless caught, causes the process to
  1378.      stop.
  1379.  
  1380.  
  1381.  
  1382.  
  1383. Page 21                                                       GNU
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. BASH(1)                   1991 July 15                    BASH(1)
  1391.  
  1392.  
  1393.  
  1394.      If the operating system on which bash is running supports
  1395.      job control, bash allows you to use it.  Typing the _✓s_✓u_✓s_✓p_✓e_✓n_✓d
  1396.      character (typically ^Z, Control-Z) while a process is run-
  1397.      ning causes that process to be stopped and returns you to
  1398.      bash.  Typing the _✓d_✓e_✓l_✓a_✓y_✓e_✓d _✓s_✓u_✓s_✓p_✓e_✓n_✓d character (typically ^Y,
  1399.      Control-Y) causes the process to be stopped when it attempts
  1400.      to read input from the terminal, and control to be returned
  1401.      to bash.  You may then manipulate the state of this job,
  1402.      using the bg command to continue it in the background, the
  1403.      fg command to continue it in the foreground, or the kill
  1404.      command to kill it.  A ^Z takes effect immediately, and has
  1405.      the additional side effect of causing pending output and
  1406.      typeahead to be discarded.
  1407.  
  1408.      There are a number of ways to refer to a job in the shell.
  1409.      The character % introduces a job name.  Job number _✓n may be
  1410.      referred to as %n.  A job may also be referred to using a
  1411.      prefix of the name used to start it, or using a substring
  1412.      that appears in its command line.  For example, %ce refers
  1413.      to a stopped ce job.  If a prefix matches more than one job,
  1414.      bash reports an error.  Using %?ce, on the other hand, would
  1415.      refer to any job containing the string ce in its command
  1416.      line.  If the substring matches more than one job, bash
  1417.      reports an error.  The symbols %% and %+ refer to the
  1418.      shell's notion of the _✓c_✓u_✓r_✓r_✓e_✓n_✓t _✓j_✓o_✓b, which is the last job
  1419.      stopped while it was in the foreground.  The _✓p_✓r_✓e_✓v_✓i_✓o_✓u_✓s _✓j_✓o_✓b
  1420.      may be referenced using %-.  In output pertaining to jobs
  1421.      (e.g. the output of the jobs command), the current job is
  1422.      always flagged with a +, and the previous job with a -.
  1423.  
  1424.      Simply naming a job can be used to bring it into the fore-
  1425.      ground:  %1 is a synonym for ``fg %1'', bringing job 1 from
  1426.      the background into the foreground.  Similarly, ``%1 &''
  1427.      resumes job 1 in the background, equivalent to ``bg %1''.
  1428.  
  1429.      The shell learns immediately whenever a job changes state.
  1430.      Normally, bash waits until it is about to print a prompt
  1431.      before reporting changes in a job's status so as to not
  1432.      interrupt any other output.  If the variable notify is set,
  1433.      bash reports such changes immediately.  (See also the -o
  1434.      notify option to the set builtin command.)
  1435.  
  1436.      If you attempt to exit bash while jobs are stopped, the
  1437.      shell prints a message warning you.  You may then use the
  1438.      jobs command to inspect their status.  If you do this, or
  1439.      try to exit again immediately, you are not warned again, and
  1440.      the stopped jobs are terminated.
  1441.  
  1442. SIGNALS
  1443.      When bash is interactive, it ignores SIGTERM (so that kill 0
  1444.      does not kill an interactive shell), and SIGINT is caught
  1445.      and handled (so that wait is interruptible).  In all cases,
  1446.  
  1447.  
  1448.  
  1449. Page 22                                                       GNU
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. BASH(1)                   1991 July 15                    BASH(1)
  1457.  
  1458.  
  1459.  
  1460.      bash ignores SIGQUIT.  If job control is in effect, bash
  1461.      ignores SIGTTIN, SIGTTOU, and SIGTSTP.
  1462.  
  1463.      Synchronous jobs started by bash have signals set to the
  1464.      values inherited by the shell from its parent.  Background
  1465.      jobs (jobs started with &) ignore SIGINT and SIGQUIT.  Com-
  1466.      mands run as a result of command substitution ignore the
  1467.      keyboard-generated job control signals SIGTTIN, SIGTTOU, and
  1468.      SIGTSTP.
  1469.  
  1470. COMMAND EXECUTION
  1471.      After a command has been split into words, if it results in
  1472.      a simple command and an optional list of arguments, the fol-
  1473.      lowing actions are taken.
  1474.  
  1475.      If the command name contains no slashes, the shell attempts
  1476.      to locate it.  If there exists a shell function by that
  1477.      name, that function is invoked as described above in FUNC-
  1478.      TIONS.  If the name does not match a function, the shell
  1479.      searches for it in the list of shell builtins.  If a match
  1480.      is found, that builtin is invoked.
  1481.  
  1482.      If the name is neither a shell function nor a builtin, and
  1483.      contains no slashes, bash searches each element of the PATH
  1484.      for a directory containing an executable file by that name.
  1485.      If the search is unsuccessful, the shell prints an error
  1486.      message and returns a nonzero exit status.
  1487.  
  1488.      If the search is successful, or if the command name contains
  1489.      one or more slashes, the shell executes the named program.
  1490.      Argument 0 is set to the name given, and the remaining argu-
  1491.      ments to the command are set to the arguments given, if any.
  1492.  
  1493.      If this execution fails because the file is not in execut-
  1494.      able format, and the file is not a directory, it is assumed
  1495.      to be a _✓s_✓h_✓e_✓l_✓l _✓s_✓c_✓r_✓i_✓p_✓t, a file containing shell commands.  A
  1496.      subshell is spawned to execute it.  This subshell reinitial-
  1497.      izes itself, so that the effect is as if a new shell had
  1498.      been invoked to handle the script, with the exception that
  1499.      the locations of commands remembered by the parent (see hash
  1500.      below under SHELL BUILTIN COMMANDS) are retained by the
  1501.      child.
  1502.  
  1503.      If the program is a file beginning with #!, the remainder of
  1504.      the first line specifies an interpreter for the program.
  1505.      The shell executes the specified interpreter on operating
  1506.      systems that do not handle this executable format them-
  1507.      selves.  The arguments to the interpreter consist of a sin-
  1508.      gle optional argument following the interpreter name on the
  1509.      first line of the program, followed by the name of the pro-
  1510.      gram, followed by the command arguments, if any.
  1511.  
  1512.  
  1513.  
  1514.  
  1515. Page 23                                                       GNU
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. BASH(1)                   1991 July 15                    BASH(1)
  1523.  
  1524.  
  1525.  
  1526. ENVIRONMENT
  1527.      When a program is invoked it is given an array of strings
  1528.      called the _✓e_✓n_✓v_✓i_✓r_✓o_✓n_✓m_✓e_✓n_✓t.  This is a list of _✓n_✓a_✓m_✓e-_✓v_✓a_✓l_✓u_✓e pairs,
  1529.      of the form _✓n_✓a_✓m_✓e=_✓v_✓a_✓l_✓u_✓e.
  1530.  
  1531.      The shell allows you to manipulate the environment in
  1532.      several ways.  On invocation, the shell scans its own
  1533.      environment and creates a parameter for each name found,
  1534.      automatically marking it for _✓e_✓x_✓p_✓o_✓r_✓t to child processes.
  1535.      Executed commands inherit the environment.  The export and
  1536.      declare -x commands allow parameters and functions to be
  1537.      added to and deleted from the environment.  If the value of
  1538.      a parameter in the environment is modified, the new value
  1539.      becomes part of the environment, replacing the old.  The
  1540.      environment inherited by any executed command consists of
  1541.      the shell's initial environment, whose values may be modi-
  1542.      fied in the shell, less any pairs removed by the unset com-
  1543.      mand, plus any additions via the export and declare -x com-
  1544.      mands.
  1545.  
  1546.      The environment for any _✓s_✓i_✓m_✓p_✓l_✓e _✓c_✓o_✓m_✓m_✓a_✓n_✓d or function may be
  1547.      augmented temporarily by prefixing it with parameter assign-
  1548.      ments, as described above in PARAMETERS.  These assignment
  1549.      statements affect only the environment seen by that command.
  1550.  
  1551.      If the -k flag is set (see the set builtin command below),
  1552.      then _✓a_✓l_✓l parameter assignments are placed in the environment
  1553.      for a command, not just those that precede the command name.
  1554.  
  1555. EXIT STATUS
  1556.      For the purposes of the shell, a command which exits with a
  1557.      zero exit status has succeeded.  An exit status of zero
  1558.      indicates success.  A non-zero exit status indicates
  1559.      failure.  When a command terminates on a fatal signal, bash
  1560.      uses the value of 128+signal as the exit status.
  1561.  
  1562.      Bash itself returns the exit status of the last command exe-
  1563.      cuted, unless a syntax error occurs, in which case it exits
  1564.      with a non-zero value.  See also the exit builtin command
  1565.      below.
  1566.  
  1567. PROMPTING
  1568.      When executing interactively, bash displays the primary
  1569.      prompt PS1 when it is ready to read a command, and the
  1570.      secondary prompt PS2 when it needs more input to complete a
  1571.      command.  Bash allows the prompt to be customized by insert-
  1572.      ing a number of backslash-escaped special characters that
  1573.      are decoded as follows:
  1574.           \t   the time
  1575.           \d   the date
  1576.           \n   CRLF
  1577.           \s   the name of the shell, the basename of $0 (the
  1578.  
  1579.  
  1580.  
  1581. Page 24                                                       GNU
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. BASH(1)                   1991 July 15                    BASH(1)
  1589.  
  1590.  
  1591.  
  1592.                portion following the final slash)
  1593.           \w   the current working directory
  1594.           \W   the basename of the current working directory
  1595.           \u   the username of the current user
  1596.           \h   the hostname
  1597.           \#   the command number of this command
  1598.           \!   the history number of this command
  1599.           \$   if the effective UID is 0, a #, otherwise a $
  1600.           \nnn character code in octal
  1601.           \\   a backslash
  1602.  
  1603.      After the string is decoded, if the variable NO_PROMPT_VARS
  1604.      is not set, it is expanded via parameter expansion, command
  1605.      substitution, arithmetic expansion, and word splitting.
  1606.  
  1607. READLINE
  1608.      This is the library that handles reading input when using an
  1609.      interactive shell, unless the -nolineediting option is
  1610.      given.  By default, the line editing commands are similar to
  1611.      those of emacs.  A vi-style line editing interface is also
  1612.      available.
  1613.  
  1614.      In this section, the emacs-style notation is used to denote
  1615.      keystrokes.  Control keys are denoted by C-_✓k_✓e_✓y, e.g. C-n
  1616.      means Control-N.  Similarly, _✓m_✓e_✓t_✓a keys are denoted by M-_✓k_✓e_✓y,
  1617.      so M-x means Meta-X.  (On keyboards without a _✓m_✓e_✓t_✓a key, M-_✓x
  1618.      means ESC _✓x, i.e. press the Escape key then the _✓x key.  The
  1619.      combination M-C-_✓x means ESC-Control-_✓x, or press the Escape
  1620.      key then hold the Control key while pressing the _✓x key.)
  1621.  
  1622.      The default key-bindings may be changed with an ~/._✓i_✓n_✓p_✓u_✓t_✓r_✓c
  1623.      file.  Other programs that use this library may add their
  1624.      own commands and bindings.
  1625.  
  1626.      For example, placing
  1627.  
  1628.           M-Control-u: universal-argument
  1629.      or
  1630.           C-Meta-u: universal-argument
  1631.      into the ~/._✓i_✓n_✓p_✓u_✓t_✓r_✓c would make M-C-u execute the command
  1632.      _✓u_✓n_✓i_✓v_✓e_✓r_✓s_✓a_✓l-_✓a_✓r_✓g_✓u_✓m_✓e_✓n_✓t.
  1633.  
  1634.      The following symbolic character names are recognized:
  1635.      RUBOUT, DEL, ESC, NEWLINE, SPACE, RETURN, LFD, TAB.
  1636.  
  1637.      Placing
  1638.  
  1639.           set editing-mode vi
  1640.  
  1641.      into a ~/._✓i_✓n_✓p_✓u_✓t_✓r_✓c file causes bash to start with a _✓v_✓i-like
  1642.      editing mode.  The editing mode may be switched during
  1643.      interactive use by using the -o option to the set builtin
  1644.  
  1645.  
  1646.  
  1647. Page 25                                                       GNU
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. BASH(1)                   1991 July 15                    BASH(1)
  1655.  
  1656.  
  1657.  
  1658.      command (see SHELL BUILTIN COMMANDS below).
  1659.  
  1660.      You can have readline use a single line for display, scrol-
  1661.      ling the input between the two borders by placing
  1662.  
  1663.           set horizontal-scroll-mode On
  1664.  
  1665.      into a ~/._✓i_✓n_✓p_✓u_✓t_✓r_✓c file.
  1666.  
  1667.      The following is a list of the names of the commands and the
  1668.      default key-strokes to get them.
  1669.  
  1670.      Commands for Moving
  1671.  
  1672.      beginning-of-line (C-a)
  1673.           Move to the start of the current line.
  1674.      end-of-line (C-e)
  1675.           Move to the end of the line.
  1676.      forward-char (C-f)
  1677.           Move forward a character.
  1678.      backward-char (C-b)
  1679.           Move back a character.
  1680.      forward-word (M-f)
  1681.           Move forward to the end of the next word.
  1682.      backward-word (M-b)
  1683.           Move back to the start of this, or the previous, word.
  1684.      clear-screen (C-l)
  1685.           Clear the screen leaving the current line at the top of
  1686.           the screen.
  1687.  
  1688.      Commands for Manipulating the History
  1689.  
  1690.      accept-line (Newline, Return)
  1691.           Accept the line regardless of where the cursor is.  If
  1692.           this line is non-empty, add it to the history list
  1693.           according to the state of the history_control variable.
  1694.           If this line was a history line, then restore the his-
  1695.           tory line to its original state.
  1696.      previous-history (C-p)
  1697.           Fetch the previous command from the history list, mov-
  1698.           ing back in the list.
  1699.      next-history (C-n)
  1700.           Fetch the next command from the history list, moving
  1701.           forward in the list.
  1702.      beginning-of-history (M-<)
  1703.           Move to the first line in the history, the first line
  1704.           entered.
  1705.      end-of-history (M->)
  1706.           Move to the end of the input history, i.e., the line
  1707.           you are entering.
  1708.      reverse-search-history (C-r)
  1709.           Search backward starting at the current line and moving
  1710.  
  1711.  
  1712.  
  1713. Page 26                                                       GNU
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. BASH(1)                   1991 July 15                    BASH(1)
  1721.  
  1722.  
  1723.  
  1724.           `up' through the history as necessary.  This is an
  1725.           incremental search.
  1726.      forward-search-history (C-s)
  1727.           Search forward starting at the current line and moving
  1728.           `down' through the history as necessary.
  1729.      shell-expand-line (M-C-e)
  1730.           Expand the line the way the shell does when it reads
  1731.           it.  This performs alias and history expansion.  See
  1732.           HISTORY below.
  1733.      insert-last-argument (M-., M-_)
  1734.           Insert the last argument to the previous command (the
  1735.           last word on the previous line).
  1736.      operate-and-get-next (C-O)
  1737.           Accept the current line for execution and fetch the
  1738.           next line relative to the current line from the history
  1739.           file for editing.
  1740.  
  1741.      Commands for Changing Text
  1742.  
  1743.      delete-char (C-d)
  1744.           Delete the character under the cursor.  If the cursor
  1745.           is at the beginning of the line, and there are no char-
  1746.           acters in the line, and the last character typed was
  1747.           not C-d, then return EOF.
  1748.      backward-delete-char (Rubout)
  1749.           Delete the character behind the cursor.  A numeric arg
  1750.           says to kill the characters instead of deleting them.
  1751.      quoted-insert (C-q, C-v)
  1752.           Add the next character that you type to the line verba-
  1753.           tim.  This is how to insert characters like C-q, for
  1754.           example.
  1755.      tab-insert (M-TAB)
  1756.           Insert a tab character.
  1757.      self-insert (a, b, A, 1, !, ...)
  1758.           Insert the character typed.
  1759.      transpose-chars (C-t)
  1760.           Drag the character before point forward over the char-
  1761.           acter at point.  Point moves forward as well.  If point
  1762.           is at the end of the line, then transpose the two char-
  1763.           acters before point.  Negative arguments don't work.
  1764.      transpose-words (M-t)
  1765.           Drag the word behind the cursor past the word in front
  1766.           of the cursor moving the cursor over that word as well.
  1767.      upcase-word (M-u)
  1768.           Uppercase the current (or following) word.  With a
  1769.           negative argument, do the previous word, but do not
  1770.           move point.
  1771.      downcase-word (M-l)
  1772.           Lowercase the current (or following) word.  With a
  1773.           negative argument, do the previous word, but do not
  1774.           move point.
  1775.      capitalize-word (M-c)
  1776.  
  1777.  
  1778.  
  1779. Page 27                                                       GNU
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. BASH(1)                   1991 July 15                    BASH(1)
  1787.  
  1788.  
  1789.  
  1790.           Capitalize the current (or following) word.  With a
  1791.           negative argument, do the previous word, but do not
  1792.           move point.
  1793.  
  1794.      Killing and Yanking
  1795.  
  1796.      kill-line (C-k)
  1797.           Kill the text from the current cursor position to the
  1798.           end of the line.  This saves the killed text on the
  1799.           kill-ring.  (see below)
  1800.      backward-kill-line
  1801.           Kill backward to the beginning of the line.  This is
  1802.           normally unbound, in favor of unix-line-discard, which
  1803.           emulates the behavior of the standard Unix terminal
  1804.           driver.
  1805.      kill-word (M-d)
  1806.           Kill from the cursor to the end of the current word, or
  1807.           if between words, to the end of the next word.
  1808.      backward-kill-word (M-Rubout)
  1809.           Kill the word behind the cursor.
  1810.      unix-line-discard (C-u)
  1811.           Do what C-u used to do in Unix line input.  We save the
  1812.           killed text on the kill-ring, though.
  1813.      unix-word-rubout (C-w)
  1814.           Do what C-w used to do in Unix line input.  The killed
  1815.           text is saved on the kill-ring.  This is different than
  1816.           backward-kill-word because the word boundaries differ.
  1817.      yank (C-y)
  1818.           Yank the top of the kill ring into the buffer at point.
  1819.      yank-pop (M-y)
  1820.           Rotate the kill-ring, and yank the new top.  Only works
  1821.           following `yank' or `yank-pop'.
  1822.  
  1823.      Arguments
  1824.  
  1825.      digit-argument (M-0, M-1, ..., M--)
  1826.           Add this digit to the argument already accumulating, or
  1827.           start a new argument.  M-- starts a negative argument.
  1828.      universal-argument
  1829.           Do what C-u does in _✓e_✓m_✓a_✓c_✓s. By default, this is not
  1830.           bound to a key.
  1831.  
  1832.      Completing
  1833.  
  1834.      complete (TAB)
  1835.           Attempt to perform completion on the text before point.
  1836.           Bash attempts completion treating the text as a vari-
  1837.           able (if the text begins with $), username (if the text
  1838.           begins with ~), hostname (if the text begins with @),
  1839.           or command (including aliases and functions) in turn.
  1840.           If none of these produces a match, filename completion
  1841.           is attempted.
  1842.  
  1843.  
  1844.  
  1845. Page 28                                                       GNU
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. BASH(1)                   1991 July 15                    BASH(1)
  1853.  
  1854.  
  1855.  
  1856.      possible-completions (M-?)
  1857.           List the possible completions of the text before point.
  1858.      complete-filename (M-/)
  1859.           Attempt filename completion on the text before point.
  1860.      possible-filename-completions (C-x /)
  1861.           List the possible completions of the text before point,
  1862.           treating it as a filename.
  1863.      complete-username (M-~)
  1864.           Attempt completion on the text before point, treating
  1865.           it as a username.
  1866.      possible-username-completions (C-x ~)
  1867.           List the possible completions of the text before point,
  1868.           treating it as a username.
  1869.      complete-variable (M-$)
  1870.           Attempt completion on the text before point, treating
  1871.           it as a shell variable.
  1872.      possible-variable-completions (C-x $)
  1873.           List the possible completions of the text before point,
  1874.           treating it as a shell variable.
  1875.      complete-hostname (M-@)
  1876.           Attempt completion on the text before point, treating
  1877.           it as a hostname.
  1878.      possible-hostname-completions (C-x @)
  1879.           List the possible completions of the text before point,
  1880.           treating it as a hostname.
  1881.  
  1882.      Miscellaneous
  1883.  
  1884.      abort (C-g)
  1885.           Abort the current editing command and ring the
  1886.           terminal's bell.
  1887.      do-uppercase-version (M-a, M-b, ...)
  1888.           Run the command that is bound to the uppercased key.
  1889.      prefix-meta (ESC)
  1890.           Metafy the next character typed.  This is for people
  1891.           without a meta key.  ESC f is equivalent to Meta-f.
  1892.      undo (C-_)
  1893.           Incremental undo, separately remembered for each line.
  1894.      revert-line (M-r)
  1895.           Undo all changes made to this line.  This is like typ-
  1896.           ing the `undo' command enough times to get back to the
  1897.           beginning.
  1898.      display-shell-version (C-x C-v)
  1899.           Display version information about the current instance
  1900.           of bash.
  1901.      emacs-editing-mode (C-e)
  1902.           When in vi editing mode, this causes a switch to emacs
  1903.           editing mode.
  1904.      vi-editing-mode (M-C-j or M-C-m)
  1905.           When in emacs editing mode, this causes a switch to vi
  1906.           editing mode.
  1907.  
  1908.  
  1909.  
  1910.  
  1911. Page 29                                                       GNU
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. BASH(1)                   1991 July 15                    BASH(1)
  1919.  
  1920.  
  1921.  
  1922. HISTORY
  1923.      The shell supports a history expansion feature that is simi-
  1924.      lar to the history expansion in csh.  This section describes
  1925.      what syntax features are available.
  1926.  
  1927.      History expansion is performed immediately after a complete
  1928.      line is read, before the shell breaks it into words.  It
  1929.      takes place in two parts.  The first is determining which
  1930.      line from the previous history to use during substitution.
  1931.      The second is to select portions of that line for inclusion
  1932.      into the current one.  The line selected from the previous
  1933.      history is the _✓e_✓v_✓e_✓n_✓t, and the portions of that line that are
  1934.      acted upon are _✓w_✓o_✓r_✓d_✓s.  The line is broken into words in the
  1935.      same fashion as when reading input, so that several English,
  1936.      or Unix, words surrounded by quotes are considered as one
  1937.      word.  Only backslash (\) can quote the history escape char-
  1938.      acter, which is ! by default.
  1939.  
  1940.      Event Designators
  1941.  
  1942.      An event designator is a reference to a command line entry
  1943.      in the history list.
  1944.  
  1945.      !    Start a history substitution, except when followed by a
  1946.           <space>, <tab>, <newline>, = or (.
  1947.      !!   Refer to the previous command.  This is a synonym for
  1948.           `!-1'.
  1949.      !_✓n   Refer to command line _✓n.
  1950.      !-_✓n  Refer to the current command line minus _✓n.
  1951.      !_✓s_✓t_✓r_✓i_✓n_✓g
  1952.           Refer to the most recent command starting with _✓s_✓t_✓r_✓i_✓n_✓g.
  1953.      !?_✓s_✓t_✓r_✓i_✓n_✓g[?]
  1954.           Refer to the most recent command containing _✓s_✓t_✓r_✓i_✓n_✓g.
  1955.  
  1956.      Word Designators
  1957.  
  1958.      A : separates the event specification from the word designa-
  1959.      tor.  It can be omitted if the word designator begins with a
  1960.      ^, $, *, or %.  Words are numbered from the beginning of the
  1961.      line, with the first word being denoted by a 0 (zero).
  1962.  
  1963.      #    The entire command line typed so far.  This means the
  1964.           current command, not the previous command, so it really
  1965.           isn't a word designator, and doesn't belong in this
  1966.           section.
  1967.      0 (zero)
  1968.           The zeroth word.  For the shell, this is the command
  1969.           word.
  1970.      _✓n    The _✓nth word.
  1971.      ^    The first argument.  That is, word 1.
  1972.      $    The last argument.
  1973.      %    The word matched by the most recent `?_✓s_✓t_✓r_✓i_✓n_✓g?' search.
  1974.  
  1975.  
  1976.  
  1977. Page 30                                                       GNU
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. BASH(1)                   1991 July 15                    BASH(1)
  1985.  
  1986.  
  1987.  
  1988.      _✓x-_✓y  A range of words; `-_✓y' abbreviates `0-_✓y'.
  1989.      *    All of the words but the zeroth.  This is a synonym for
  1990.           `1-$'.  It is not an error to use * if there is just
  1991.           one word in the event; the empty string is returned in
  1992.           that case.
  1993.  
  1994.      Modifiers
  1995.  
  1996.      After the optional word designator, you can add a sequence
  1997.      of one or more of the following modifiers, each preceded by
  1998.      a `:'.
  1999.  
  2000.      h    Remove a trailing pathname component, leaving only the
  2001.           head.
  2002.      r    Remove a trailing suffix of the form ".xxx", leaving
  2003.           the basename.
  2004.      e    Remove all but the suffix.
  2005.      t    Remove all leading pathname components, leaving the
  2006.           tail.
  2007.      p    Print the new command but do not execute it.  This
  2008.           takes effect immediately, so it should be the last
  2009.           specifier on the line.
  2010.  
  2011. ARITHMETIC EVALUATION
  2012.      The shell allows arithmetic expressions to be evaluated,
  2013.      under certain circumstances (see the let builtin command and
  2014.      Arithmetic Expansion).  Evaluation is done in long integers
  2015.      with no check for overflow, though division by 0 is trapped
  2016.      and flagged as an error.  The following list of operators is
  2017.      grouped into levels of equal-precedence operators.  The lev-
  2018.      els are listed in order of decreasing precedence.
  2019.  
  2020.      -    unary minus
  2021.      !    logical NOT
  2022.      * / %
  2023.           multiplication, division, remainder
  2024.      + -  addition, subtraction
  2025.      <= >= < >
  2026.           comparison
  2027.      == !=
  2028.           equality and inequality
  2029.      =    assignment
  2030.  
  2031.      Shell variables are allowed as operands; parameter expansion
  2032.      is performed before the expression is evaluated. The value
  2033.      of a parameter is coerced to a long integer within an
  2034.      expression.  A shell variable need not have its integer
  2035.      attribute turned on to be used in an expression.
  2036.  
  2037.      Operators are evaluated in order of precedence.  Sub-
  2038.      expressions in parentheses are evaluated first and may over-
  2039.      ride the precedence rules above.
  2040.  
  2041.  
  2042.  
  2043. Page 31                                                       GNU
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050. BASH(1)                   1991 July 15                    BASH(1)
  2051.  
  2052.  
  2053.  
  2054. SHELL BUILTIN COMMANDS
  2055.      : [_✓a_✓r_✓g_✓u_✓m_✓e_✓n_✓t_✓s]
  2056.           No effect; the command does nothing beyond expanding
  2057.           _✓a_✓r_✓g_✓u_✓m_✓e_✓n_✓t_✓s and performing any specified redirections.  A
  2058.           zero exit code is returned.
  2059.           Read and execute commands from _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e in the current
  2060.           shell environment and return the exit status of the
  2061.           last command executed from _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e.  Pathnames in PATH
  2062.           are used to find the directory containing _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e, if
  2063.           _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e does not contain a slash.  The file searched
  2064.           for in PATH need not be executable.  The current direc-
  2065.           tory is searched if no file is found in PATH.  The
  2066.           return status is the status of the last command exited
  2067.           within the script (true if no commands are executed),
  2068.           and false if _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e is not found.
  2069.  
  2070.      alias [_✓n_✓a_✓m_✓e[=_✓v_✓a_✓l_✓u_✓e] ...]
  2071.           Alias with no arguments prints the list of aliases in
  2072.           the form _✓n_✓a_✓m_✓e=_✓v_✓a_✓l_✓u_✓e on standard output.  When arguments
  2073.           are supplied, an alias is defined for each _✓n_✓a_✓m_✓e whose
  2074.           _✓v_✓a_✓l_✓u_✓e is given.  A trailing space in _✓v_✓a_✓l_✓u_✓e causes the
  2075.           next word to be checked for alias substitution when the
  2076.           alias is expanded.  Alias returns true unless a _✓n_✓a_✓m_✓e is
  2077.           given for which no alias has been defined.
  2078.  
  2079.      bg [_✓j_✓o_✓b_✓s_✓p_✓e_✓c]
  2080.           Place _✓j_✓o_✓b_✓s_✓p_✓e_✓c in the background, as if it had been
  2081.           started with &.  If _✓j_✓o_✓b_✓s_✓p_✓e_✓c is not present, the shell's
  2082.           notion of the _✓c_✓u_✓r_✓r_✓e_✓n_✓t _✓j_✓o_✓b is used.
  2083.  
  2084.      bind [-lvd] [-q _✓n_✓a_✓m_✓e]
  2085.      bind -f _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e
  2086.      bind _✓k_✓e_✓y_✓s_✓e_✓q:_✓f_✓u_✓n_✓c_✓t_✓i_✓o_✓n-_✓n_✓a_✓m_✓e
  2087.           Display current readline key and function bindings, or
  2088.           bind a key sequence to a readline function or macro.
  2089.           The binding syntax accepted is identical to that of
  2090.           ._✓i_✓n_✓p_✓u_✓t_✓r_✓c, but each binding must be passed as a separate
  2091.           argument; e.g. '"\C-x\C-r": re-read-init-file'.
  2092.           Options, if supplied, have the following meanings:
  2093.           -l   List the names of all readline functions
  2094.           -v   List current function names and bindings
  2095.           -d   Dump function names and bindings in such a way
  2096.                that they can be re-read
  2097.           -f _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e
  2098.                Read key bindings from _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e
  2099.           -q _✓f_✓u_✓n_✓c_✓t_✓i_✓o_✓n
  2100.                Query about which keys invoke the named _✓f_✓u_✓n_✓c_✓t_✓i_✓o_✓n
  2101.  
  2102.      break [_✓n]
  2103.           Exit from within a for, while, or until loop.  If _✓n is
  2104.           specified, break _✓n levels.  _✓n must be _✓> 1.  If _✓n is
  2105.           greater than the number of enclosing loops, all
  2106.  
  2107.  
  2108.  
  2109. Page 32                                                       GNU
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116. BASH(1)                   1991 July 15                    BASH(1)
  2117.  
  2118.  
  2119.  
  2120.           enclosing loops are exited.  The return value is 0
  2121.           unless the shell is not executing a loop when break is
  2122.           executed.
  2123.  
  2124.      builtin [_✓s_✓h_✓e_✓l_✓l-_✓b_✓u_✓i_✓l_✓t_✓i_✓n [_✓a_✓r_✓g_✓u_✓m_✓e_✓n_✓t_✓s]]
  2125.           Execute the specified shell builtin, passing it _✓a_✓r_✓g_✓u_✓-
  2126.           _✓m_✓e_✓n_✓t_✓s, and return its exit status.  This is useful when
  2127.           you wish to define a function whose name is the same as
  2128.           a shell builtin, but need the functionality of the
  2129.           builtin within the function itself.  The cd builtin is
  2130.           commonly redefined this way.
  2131.  
  2132.      cd [_✓d_✓i_✓r]
  2133.           Change the current directory to _✓d_✓i_✓r.  The variable HOME
  2134.           is the default _✓d_✓i_✓r.  The variable CDPATH defines the
  2135.           search path for the directory containing _✓d_✓i_✓r.  Alterna-
  2136.           tive directory names are separated by a colon (:).  A
  2137.           null directory name in CDPATH is the same as the
  2138.           current directory, i.e. ``.''.  If _✓d_✓i_✓r begins with a
  2139.           slash (/), then CDPATH is not used.  An argument of -
  2140.           is equivalent to $OLDPWD.  The return value is true if
  2141.           the directory was successfully changed; false other-
  2142.           wise.
  2143.  
  2144.      command [-p] [_✓c_✓o_✓m_✓m_✓a_✓n_✓d [_✓a_✓r_✓g ...]]
  2145.           Run _✓c_✓o_✓m_✓m_✓a_✓n_✓d with _✓a_✓r_✓g_✓s suppressing the normal shell
  2146.           function lookup. Only builtin commands or commands
  2147.           found in the PATH are executed.  If the -p option is
  2148.           given, the search for _✓c_✓o_✓m_✓m_✓a_✓n_✓d is performed using a
  2149.           default value for PATH that is guaranteed to find all
  2150.           of the standard utilities.  An argument of -- disables
  2151.           option checking for the rest of the arguments.  If an
  2152.           error occurred or _✓c_✓o_✓m_✓m_✓a_✓n_✓d cannot be found, the exit
  2153.           status is 127.  Otherwise, the exit status of the com-
  2154.           mand builtin is the exit status of _✓c_✓o_✓m_✓m_✓a_✓n_✓d.
  2155.  
  2156.      continue [_✓n]
  2157.           Resume the next iteration of the enclosing for, while,
  2158.           or until loop.  If _✓n is specified, resume at the _✓nth
  2159.           enclosing loop.  _✓n must be _✓> 1.  If _✓n is greater than
  2160.           the number of enclosing loops, the last enclosing loop
  2161.           (the `top-level' loop) is resumed.  The return value is
  2162.           0 unless the shell is not executing a loop when con-
  2163.           tinue is executed.
  2164.  
  2165.      declare [-frxi] [_✓n_✓a_✓m_✓e[=_✓v_✓a_✓l_✓u_✓e]]
  2166.      typeset [-frxi] [_✓n_✓a_✓m_✓e[=_✓v_✓a_✓l_✓u_✓e]]
  2167.           Declare variables and/or give them attributes.  If no
  2168.           _✓n_✓a_✓m_✓es are given, then display the values of variables
  2169.           instead.
  2170.           -f   Use function names only
  2171.           -r   Make _✓n_✓a_✓m_✓es readonly.  These names cannot then be
  2172.  
  2173.  
  2174.  
  2175. Page 33                                                       GNU
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182. BASH(1)                   1991 July 15                    BASH(1)
  2183.  
  2184.  
  2185.  
  2186.                assigned values by subsequent assignment state-
  2187.                ments.
  2188.           -x   Mark _✓n_✓a_✓m_✓es for export to subsequent commands via
  2189.                the environment.
  2190.           -i   The variable is treated as an integer; arithmetic
  2191.                evaluation (see ARITHMETIC EVALUATION ) is per-
  2192.                formed when the variable is assigned a value.
  2193.  
  2194.           Using `+' instead of `-' turns off the attribute
  2195.           instead.  When used in a function, makes _✓n_✓a_✓m_✓es local,
  2196.           as with the local command.
  2197.  
  2198.      dirs Display the list of currently remembered directories.
  2199.           Directories are added to the list with the pushd com-
  2200.           mand; the popd command moves back up through the list.
  2201.  
  2202.      echo [-ne] [_✓a_✓r_✓g ...]
  2203.           Output the _✓a_✓r_✓gs, separated by spaces.  If -n is speci-
  2204.           fied, the trailing newline is suppressed.  If the -e
  2205.           option is given, interpretation of the following
  2206.           backslash-escaped characters is enabled:
  2207.           \a   alert (bell)
  2208.           \b   backspace
  2209.           \c   suppress trailing newline
  2210.           \f   form feed
  2211.           \n   new line
  2212.           \r   carriage return
  2213.           \t   horizontal tab
  2214.           \v   vertical tab
  2215.           \\   backslash
  2216.           \nnn the character whose ASCII code is _✓n_✓n_✓n (octal)
  2217.  
  2218.      enable [-n] [_✓n_✓a_✓m_✓e ...]
  2219.           Enable and disable builtin shell commands.  This allows
  2220.           the execution of a disk command which has the same name
  2221.           as a shell builtin without specifying a full pathname.
  2222.           If -n is used, each _✓n_✓a_✓m_✓e is disabled; otherwise, _✓n_✓a_✓m_✓e_✓s
  2223.           are enabled.  For example, to use the test found in
  2224.           PATH instead of the shell builtin version, type
  2225.           ``enable -n test''.
  2226.  
  2227.      eval [_✓a_✓r_✓g ...]
  2228.           The _✓a_✓r_✓gs are read and concatenated together into a sin-
  2229.           gle command.  This command is then read and executed by
  2230.           the shell, and its exit status is returned as the value
  2231.           of the eval command.  If there are no _✓a_✓r_✓g_✓s, or only
  2232.           null arguments, eval returns true.
  2233.  
  2234.      exec [[-] _✓c_✓o_✓m_✓m_✓a_✓n_✓d [_✓a_✓r_✓g_✓u_✓m_✓e_✓n_✓t_✓s]]
  2235.           If _✓c_✓o_✓m_✓m_✓a_✓n_✓d is specified, it replaces the shell.  No new
  2236.           process is created.  The _✓a_✓r_✓g_✓u_✓m_✓e_✓n_✓t_✓s become the arguments
  2237.           to _✓c_✓o_✓m_✓m_✓a_✓n_✓d.  If the first argument is -, the shell
  2238.  
  2239.  
  2240.  
  2241. Page 34                                                       GNU
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248. BASH(1)                   1991 July 15                    BASH(1)
  2249.  
  2250.  
  2251.  
  2252.           places a dash in the zeroth arg passed to _✓c_✓o_✓m_✓m_✓a_✓n_✓d.
  2253.           This is what login does.  If the file cannot be exe-
  2254.           cuted for some reason, the shell exits, unless the
  2255.           shell variable no_exit_on_failed_exec exists.  If _✓c_✓o_✓m_✓-
  2256.           _✓m_✓a_✓n_✓d is not specified, any redirections take effect in
  2257.           the current shell.
  2258.  
  2259.      exit [_✓n]
  2260.      bye [_✓n]
  2261.           Cause the shell to exit with a status of _✓n.  If _✓n is
  2262.           omitted, the exit status is that of the last command
  2263.           executed.  A trap on EXIT is executed before the shell
  2264.           terminates.
  2265.  
  2266.      export [-npf] [_✓n_✓a_✓m_✓e[=_✓w_✓o_✓r_✓d]] ...
  2267.           The supplied _✓n_✓a_✓m_✓e_✓s are marked for automatic export to
  2268.           the environment of subsequently executed commands.  If
  2269.           the -f option is given, the _✓n_✓a_✓m_✓e_✓s refer to functions.
  2270.           If no _✓n_✓a_✓m_✓e_✓s are given, or if the -p option is supplied,
  2271.           a list of all names that are exported in this shell is
  2272.           printed.  The -n option causes the export property to
  2273.           be removed from the named variables.  An argument of --
  2274.           disables option checking for the rest of the arguments.
  2275.           export returns an exit status of true unless an illegal
  2276.           option is encountered.
  2277.  
  2278.      fc [-e _✓e_✓n_✓a_✓m_✓e] [-nlr] [_✓f_✓i_✓r_✓s_✓t] [_✓l_✓a_✓s_✓t]
  2279.      fc -s [_✓p_✓a_✓t=_✓r_✓e_✓p] [_✓c_✓m_✓d]
  2280.           Fix Command.  In the first form, a range of commands
  2281.           from _✓f_✓i_✓r_✓s_✓t to _✓l_✓a_✓s_✓t is selected from the history list.
  2282.           _✓F_✓i_✓r_✓s_✓t and _✓l_✓a_✓s_✓t may be specified as a string (to locate
  2283.           the last command beginning with that string) or as a
  2284.           number (an index into the history list, where a nega-
  2285.           tive number is used as an offset from the current com-
  2286.           mand number).  If _✓l_✓a_✓s_✓t is not specified it is set to
  2287.           the current command for listing (so that fc -l -10
  2288.           prints the last 10 commands) and to _✓f_✓i_✓r_✓s_✓t otherwise.
  2289.           If _✓f_✓i_✓r_✓s_✓t is not specified it is set to the previous
  2290.           command for editing and -16 for listing.
  2291.  
  2292.           The -n flag suppresses the command numbers when list-
  2293.           ing.  The -r flag reverses the order of the commands.
  2294.           If the -l flag is given, the commands are listed on
  2295.           standard output.  Otherwise, the editor given by _✓e_✓n_✓a_✓m_✓e
  2296.           is invoked on a file containing those commands.  If
  2297.           _✓e_✓n_✓a_✓m_✓e is not given, the value of the FCEDIT variable is
  2298.           used, and the value of EDITOR if FCEDIT is not set.  If
  2299.           neither variable is set, _✓v_✓i is used.  When editing is
  2300.           complete, the edited commands are echoed and executed.
  2301.  
  2302.           In the second form, the command is re-executed after
  2303.           the substitution _✓o_✓l_✓d=_✓n_✓e_✓w is performed.  A useful alias
  2304.  
  2305.  
  2306.  
  2307. Page 35                                                       GNU
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. BASH(1)                   1991 July 15                    BASH(1)
  2315.  
  2316.  
  2317.  
  2318.           to use with this is ``r=fc -s'', so that typing ``r
  2319.           cc'' runs the last command beginning with ``cc'' and
  2320.           typing ``r'' re-executes the last command.
  2321.  
  2322.      fg [_✓j_✓o_✓b_✓s_✓p_✓e_✓c]
  2323.           Place _✓j_✓o_✓b_✓s_✓p_✓e_✓c in the foreground, and make it the
  2324.           current job.  If _✓j_✓o_✓b_✓s_✓p_✓e_✓c is not present, the shell's
  2325.           notion of the _✓c_✓u_✓r_✓r_✓e_✓n_✓t _✓j_✓o_✓b is used.
  2326.  
  2327.      getopts _✓o_✓p_✓t_✓s_✓t_✓r_✓i_✓n_✓g _✓n_✓a_✓m_✓e [_✓a_✓r_✓g_✓s]
  2328.           getopts is used by shell procedures to parse positional
  2329.           parameters.  _✓o_✓p_✓t_✓s_✓t_✓r_✓i_✓n_✓g contains the option letters to
  2330.           be recognized; if a letter is followed by a colon, the
  2331.           option is expected to have an argument, which should be
  2332.           separated from it by white space.  Each time it is
  2333.           invoked, getopts places the next option in the shell
  2334.           variable _✓n_✓a_✓m_✓e, initializing _✓n_✓a_✓m_✓e if it does not exist,
  2335.           and the index of the next argument to be processed into
  2336.           the variable OPTIND.  OPTIND is initialized to 1 each
  2337.           time the shell or a shell script is invoked.  When an
  2338.           option requires an argument, getopts places that argu-
  2339.           ment into the variable OPTARG.
  2340.  
  2341.           getopts can report errors in two ways.  If the first
  2342.           character of _✓o_✓p_✓t_✓s_✓t_✓r_✓i_✓n_✓g is a colon, _✓s_✓i_✓l_✓e_✓n_✓t error report-
  2343.           ing is used.  In normal operation diagnostic messages
  2344.           are printed when illegal options or missing option
  2345.           arguments are encountered.  If the variable OPTERR is
  2346.           set to 0, no error message will be displayed, even if
  2347.           the first character of _✓o_✓p_✓t_✓s_✓t_✓r_✓i_✓n_✓g is not a colon.
  2348.  
  2349.           If an illegal option is seen, getopts places ? into
  2350.           _✓n_✓a_✓m_✓e and, if not silent, prints an error message and
  2351.           unsets OPTARG.  If getopts is silent, the option char-
  2352.           acter found is placed in OPTARG and no diagnostic mes-
  2353.           sage is printed.
  2354.  
  2355.           If a required argument is not found, and getopts is not
  2356.           silent, a question mark (?) is placed in _✓n_✓a_✓m_✓e, OPTARG
  2357.           is unset, and a diagnostic message is printed.  If
  2358.           getopts is silent, then a colon (:) is placed in _✓n_✓a_✓m_✓e
  2359.           and OPTARG is set to the option character found.
  2360.  
  2361.           getopts normally parses the positional parameters, but
  2362.           if more arguments are given in _✓a_✓r_✓g_✓s, getopts parses
  2363.           those instead.  getopts returns true if an option,
  2364.           specified or unspecified, is found.  It returns false
  2365.           if the end of options is encountered or an error
  2366.           occurs.
  2367.  
  2368.      hash [-r] [_✓n_✓a_✓m_✓e]
  2369.           For each _✓n_✓a_✓m_✓e, the full pathname of the command is
  2370.  
  2371.  
  2372.  
  2373. Page 36                                                       GNU
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380. BASH(1)                   1991 July 15                    BASH(1)
  2381.  
  2382.  
  2383.  
  2384.           determined and remembered.  The -r option causes the
  2385.           shell to forget all remembered locations.  If no argu-
  2386.           ments are given, information about remembered commands
  2387.           is printed.  An argument of -- disables option checking
  2388.           for the rest of the arguments.  The return status is
  2389.           true unless a _✓n_✓a_✓m_✓e is not found or an illegal option is
  2390.           supplied.
  2391.  
  2392.      help [_✓p_✓a_✓t_✓t_✓e_✓r_✓n]
  2393.           Display helpful information about builtin commands.  If
  2394.           _✓p_✓a_✓t_✓t_✓e_✓r_✓n is specified, help gives detailed help on all
  2395.           commands matching _✓p_✓a_✓t_✓t_✓e_✓r_✓n; otherwise a list of the
  2396.           builtins is printed.
  2397.  
  2398.      history [_✓n]
  2399.      history -rwan [_✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e]
  2400.           With no options, display the command history list with
  2401.           line numbers.  Lines listed with with a * have been
  2402.           modified.  An argument of _✓n lists only the last _✓n
  2403.           lines.  If a non-option argument is supplied, it is
  2404.           used as the name of the history file; if not, the value
  2405.           of HISTFILE (default ~/._✓b_✓a_✓s_✓h__✓h_✓i_✓s_✓t_✓o_✓r_✓y) is used.
  2406.           Options, if supplied, have the following meanings:
  2407.           -a   Append the ``new'' history lines (history lines
  2408.                entered since the beginning of the current bash
  2409.                session) to the history file
  2410.           -n   Read the history lines not already read from the
  2411.                history file into the current history list.  These
  2412.                are lines appended to the history file since the
  2413.                beginning of the current bash session.
  2414.           -r   read the contents of the history file and use them
  2415.                as the current history
  2416.           -w   write the current history to the history file,
  2417.                overwriting the history file's contents.
  2418.  
  2419.      jobs [-lnp] [ _✓j_✓o_✓b_✓s_✓p_✓e_✓c ... ]
  2420.           Lists the active jobs.  The -l option lists process IDs
  2421.           in addition to the normal information; the -p option
  2422.           lists only the process ID of the job's process group
  2423.           leader.  The -n option displays only jobs that have
  2424.           changed status since last notfied.  If _✓j_✓o_✓b_✓s_✓p_✓e_✓c is
  2425.           given, output is restricted to information about that
  2426.           job.
  2427.  
  2428.      kill [-s sigspec | -sigspec] [_✓p_✓i_✓d | _✓j_✓o_✓b_✓s_✓p_✓e_✓c] ...
  2429.      kill -l [_✓s_✓i_✓g_✓n_✓u_✓m]
  2430.           Send the signal named by _✓s_✓i_✓g_✓s_✓p_✓e_✓c to the processes named
  2431.           by _✓p_✓i_✓d or _✓j_✓o_✓b_✓s_✓p_✓e_✓c.  _✓s_✓i_✓g_✓s_✓p_✓e_✓c is either a signal name
  2432.           such as SIGKILL or a signal number.  If _✓s_✓i_✓g_✓s_✓p_✓e_✓c is a
  2433.           signal name, the name is case insensitive and may be
  2434.           given with or without the SIG prefix.  If _✓s_✓i_✓g_✓s_✓p_✓e_✓c is
  2435.           not present, then SIGTERM is assumed.  An argument of
  2436.  
  2437.  
  2438.  
  2439. Page 37                                                       GNU
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446. BASH(1)                   1991 July 15                    BASH(1)
  2447.  
  2448.  
  2449.  
  2450.           -l lists the signal names.  If any arguments are sup-
  2451.           plied when -l is given, the names of the specified sig-
  2452.           nals are listed.  An argument of -- disables option
  2453.           checking for the rest of the arguments.  kill returns
  2454.           true if at least one signal was successfully sent, or
  2455.           false if an error occurs.
  2456.  
  2457.      let _✓a_✓r_✓g [_✓a_✓r_✓g ...]
  2458.           Each _✓a_✓r_✓g is an arithmetic expression to be evaluated
  2459.           (see ARITHMETIC EVALUATION).  If the last _✓a_✓r_✓g evaluates
  2460.           to 0, let returns 1; 0 is returned otherwise.
  2461.  
  2462.      local [_✓n_✓a_✓m_✓e[=_✓v_✓a_✓l_✓u_✓e]]
  2463.           Create a local variable named _✓n_✓a_✓m_✓e, and assign it
  2464.           _✓v_✓a_✓l_✓u_✓e.  When local is used within a function, it causes
  2465.           the variable _✓n_✓a_✓m_✓e to have a visible scope restricted to
  2466.           that function and its children.  With no operands,
  2467.           local writes a list of local variables to the standard
  2468.           output.  It is an error to use local when not within a
  2469.           function.
  2470.  
  2471.      logout
  2472.           Exit a login shell.
  2473.  
  2474.      popd [+/-n]
  2475.           Removes entries from the directory stack.  With no
  2476.           arguments, removes the top directory from the stack,
  2477.           and performs a cd to the new top directory.
  2478.           +n   removes the _✓nth entry counting from the left of
  2479.                the list shown by dirs, starting with zero.  For
  2480.                example: ``popd +0'' removes the first directory,
  2481.                ``popd +1'' the second.
  2482.           -n   removes the _✓nth entry counting from the right of
  2483.                the list shown by dirs, starting with zero.  For
  2484.                example: ``popd -0'' removes the last directory,
  2485.                ``popd -1'' the next to last.
  2486.  
  2487.           If the variable pushd_silent is unset and the popd com-
  2488.           mand is successful, a dirs is performed as well.
  2489.  
  2490.      pushd _✓d_✓i_✓r
  2491.      pushd +/-n
  2492.           Adds a directory to the top of the directory stack, or
  2493.           rotates the stack, making the new top of the stack the
  2494.           current working directory.  With no arguments,
  2495.           exchanges the top two directories.
  2496.           +n   Rotates the stack so that the _✓nth directory
  2497.                (counting from the left of the list shown by dirs)
  2498.                is at the top.
  2499.           -n   Rotates the stack so that the _✓nth directory
  2500.                (counting from the right) is at the top.
  2501.           dir  adds _✓d_✓i_✓r to the directory stack at the top, making
  2502.  
  2503.  
  2504.  
  2505. Page 38                                                       GNU
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512. BASH(1)                   1991 July 15                    BASH(1)
  2513.  
  2514.  
  2515.  
  2516.                it the new current working directory.
  2517.  
  2518.           If the variable pushd_silent is not set and the pushd
  2519.           command is successful, a dirs is performed as well.
  2520.  
  2521.      pwd  Print the absolute pathname of the current working
  2522.           directory.  The path printed contains no symbolic links
  2523.           (but see the description of nolinks under Shell Vari-
  2524.           ables above).
  2525.  
  2526.      read [-r] [_✓n_✓a_✓m_✓e ...]
  2527.           One line is read from the standard input, and the first
  2528.           word is assigned to the first _✓n_✓a_✓m_✓e, the second word to
  2529.           the second _✓n_✓a_✓m_✓e, and so on, with leftover words
  2530.           assigned to the last _✓n_✓a_✓m_✓e.  Only the characters in IFS
  2531.           are recognized as word delimiters.  The return code is
  2532.           zero, unless end-of-file is encountered.  If the -r
  2533.           option is given, a backslash-newline pair is not
  2534.           ignored, and the backslash is considered to be part of
  2535.           the line.
  2536.  
  2537.      readonly [-pf] [_✓n_✓a_✓m_✓e ...]
  2538.           The given _✓n_✓a_✓m_✓e_✓s are marked readonly and the values of
  2539.           these _✓n_✓a_✓m_✓e_✓s may not be changed by subsequent assign-
  2540.           ment.  If the -f option is supplied, the functions
  2541.           corresponding to the _✓n_✓a_✓m_✓e_✓s are so marked.  If no argu-
  2542.           ments are given, or if the -p option is supplied, a
  2543.           list of all readonly names is printed.  An argument of
  2544.           -- disables option checking for the rest of the argu-
  2545.           ments.
  2546.  
  2547.      return [_✓n]
  2548.           Causes a function to exit with the return value speci-
  2549.           fied by _✓n.  If _✓n is omitted, the return status is that
  2550.           of the last command executed in the function body.  If
  2551.           used outside a function, but during execution of a
  2552.           script by the . (source) command, it causes the shell
  2553.           to stop executing that script and return either _✓n or
  2554.           the exit status of the last command executed within the
  2555.           script as the exit status of the script.
  2556.  
  2557.      set [-aefhknotuvxldCH] [_✓a_✓r_✓g ...]
  2558.           -a      Automatically mark variables which are modified
  2559.                   or created for export to the environment of
  2560.                   subsequent commands.
  2561.           -e      Exit immediately if a _✓s_✓i_✓m_✓p_✓l_✓e-_✓c_✓o_✓m_✓m_✓a_✓n_✓d (see SHELL
  2562.                   GRAMMAR above) exits with a non-zero status.
  2563.                   The shell does not exit if the command that
  2564.                   fails is part of an _✓u_✓n_✓t_✓i_✓l or _✓w_✓h_✓i_✓l_✓e loop, part
  2565.                   of an _✓i_✓f statement, part of a && or || list, or
  2566.                   if the command's return value is being inverted
  2567.                   via !.
  2568.  
  2569.  
  2570.  
  2571. Page 39                                                       GNU
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. BASH(1)                   1991 July 15                    BASH(1)
  2579.  
  2580.  
  2581.  
  2582.           -f      Disable pathname expansion.
  2583.           -h      Locate and remember function commands as func-
  2584.                   tions are defined.  Function commands are nor-
  2585.                   mally looked up when the function is executed.
  2586.           -k      All keyword arguments are placed in the
  2587.                   environment for a command, not just those that
  2588.                   precede the command name.
  2589.           -m      Monitor mode.  Job control is enabled.  This
  2590.                   flag is on by default for interactive shells on
  2591.                   systems that support it (see JOB CONTROL
  2592.                   above).  Background processes run in a separate
  2593.                   process group and a line containing their exit
  2594.                   status is printed upon their completion.
  2595.           -n      Read commands but do not execute them.  This
  2596.                   may be used to check a shell script for syntax
  2597.                   errors.  This is ignored for interactive
  2598.                   shells.
  2599.           -o _✓o_✓p_✓t_✓i_✓o_✓n-_✓n_✓a_✓m_✓e
  2600.                   The _✓o_✓p_✓t_✓i_✓o_✓n-_✓n_✓a_✓m_✓e can be one of the following:
  2601.                   allexport
  2602.                           Same as -a.
  2603.                   braceexpand
  2604.                           The shell performs curly brace expan-
  2605.                           sion (see Brace Expansion above).  This
  2606.                           is on by default.
  2607.                   emacs   Use an emacs-style command line editing
  2608.                           interface.
  2609.                   errexit Same as -e.
  2610.                   histexpand
  2611.                           Same as -H.
  2612.                   ignoreeof
  2613.                           The effect is as if the shell command
  2614.                           `IGNOREEOF=10' had been executed (see
  2615.                           Shell Variables above).
  2616.                   monitor Same as -m.
  2617.                   noclobber
  2618.                           Same as -C.
  2619.                   noexec  Same as -n.
  2620.                   noglob  Same as -f.
  2621.                   nohash  Same as -d.
  2622.                   notify  The effect is as if the shell command
  2623.                           `notify=' had been executed (see Shell
  2624.                           Variables above).
  2625.                   nounset Same as -u.
  2626.                   verbose Same as -v.
  2627.                   vi      Use a vi-style command line editing
  2628.                           interface.
  2629.                   xtrace  Same as -x.
  2630.                   If no _✓o_✓p_✓t_✓i_✓o_✓n-_✓n_✓a_✓m_✓e is supplied, the values of
  2631.                   the current options are printed.
  2632.           -t      Exit after reading and executing one command.
  2633.           -u      Treat unset variables as an error when
  2634.  
  2635.  
  2636.  
  2637. Page 40                                                       GNU
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644. BASH(1)                   1991 July 15                    BASH(1)
  2645.  
  2646.  
  2647.  
  2648.                   performing parameter expansion.  If expansion
  2649.                   is attempted on an unset variable, the shell
  2650.                   prints an error message, and, if not interac-
  2651.                   tive, exits with a non-zero status.
  2652.           -v      Print shell input lines as they are read.
  2653.           -x      After expanding each _✓s_✓i_✓m_✓p_✓l_✓e-_✓c_✓o_✓m_✓m_✓a_✓n_✓d, bash
  2654.                   displays the expanded value of PS4, followed by
  2655.                   the command and its expanded arguments.
  2656.           -l      Save and restore the binding of _✓n_✓a_✓m_✓e in a for
  2657.                   _✓n_✓a_✓m_✓e [in word] command (see SHELL GRAMMAR
  2658.                   above).
  2659.           -d      Disable the hashing of commands that are looked
  2660.                   up for execution.  Normally, commands are
  2661.                   remembered in a hash table, and once found, do
  2662.                   not have to be looked up again.
  2663.           -C      The effect is as if the shell command
  2664.                   `noclobber=' had been executed (see Shell Vari-
  2665.                   ables above).
  2666.           -H      Enable ! style history substitution.  This flag
  2667.                   is on by by default.
  2668.           --      If no arguments follow this flag, then the
  2669.                   positional parameters are unset.  Otherwise,
  2670.                   the positional parameters are set to the _✓a_✓r_✓gs,
  2671.                   even if some of them begin with a -.
  2672.           -       Signal the end of options, cause all remaining
  2673.                   _✓a_✓r_✓gs to be assigned to the positional parame-
  2674.                   ters.  The -x and -v options are turned off.
  2675.                   If there are no _✓a_✓r_✓gs, the positional parameters
  2676.                   remain unchanged.
  2677.  
  2678.           Using + rather than - causes these flags to be turned
  2679.           off.  The flags can also be specified as options to an
  2680.           invocation of the shell.  The current set of flags may
  2681.           be found in $-.  After the option arguments are pro-
  2682.           cessed, the remaining _✓a_✓r_✓gs are treated as values for
  2683.           the positional parameters and are assigned, in order,
  2684.           to $1, $2, ... $9.  If no options or _✓a_✓r_✓gs are supplied,
  2685.           all shell variables are printed.  The return status is
  2686.           always true unless an illegal option is encountered.
  2687.  
  2688.      shift [_✓n]
  2689.           The positional parameters from _✓n+1 ... are renamed to
  2690.           $1 .... If _✓n is not given, it is assumed to be 1.  The
  2691.           exit status is 1 if _✓n is greater than $#; otherwise 0.
  2692.  
  2693.      suspend [-f]
  2694.           Suspend the execution of this shell until it receives a
  2695.           SIGCONT signal.  The -f option says not to complain if
  2696.           this is a login shell; just suspend anyway.
  2697.  
  2698.      test _✓e_✓x_✓p_✓r
  2699.      [ _✓e_✓x_✓p_✓r ]
  2700.  
  2701.  
  2702.  
  2703. Page 41                                                       GNU
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710. BASH(1)                   1991 July 15                    BASH(1)
  2711.  
  2712.  
  2713.  
  2714.           Return a status of 0 (true) or 1 (false) depending on
  2715.           the evaluation of the conditional expression _✓e_✓x_✓p_✓r.
  2716.           Expressions may be unary or binary.  Unary expressions
  2717.           are often used to examine the status of a file.  There
  2718.           are string operators and numeric comparison operators
  2719.           as well.
  2720.           -b _✓f_✓i_✓l_✓e
  2721.                True if _✓f_✓i_✓l_✓e exists and is block special.
  2722.           -c _✓f_✓i_✓l_✓e
  2723.                True if _✓f_✓i_✓l_✓e exists and is character special.
  2724.           -d _✓f_✓i_✓l_✓e
  2725.                True if _✓f_✓i_✓l_✓e exists and is a directory.
  2726.           -e _✓f_✓i_✓l_✓e
  2727.                True if _✓f_✓i_✓l_✓e exists
  2728.           -f _✓f_✓i_✓l_✓e
  2729.                True if _✓f_✓i_✓l_✓e exists and is a regular file.
  2730.           -g _✓f_✓i_✓l_✓e
  2731.                True if _✓f_✓i_✓l_✓e exists and is set-group-id.
  2732.           -k _✓f_✓i_✓l_✓e
  2733.                True if _✓f_✓i_✓l_✓e has its ``sticky'' bit set.
  2734.           -L _✓f_✓i_✓l_✓e
  2735.                True if _✓f_✓i_✓l_✓e exists and is a symbolic link.
  2736.           -p _✓f_✓i_✓l_✓e
  2737.                True if _✓f_✓i_✓l_✓e exists and is a named pipe.
  2738.           -r _✓f_✓i_✓l_✓e
  2739.                True if _✓f_✓i_✓l_✓e exists and is readable.
  2740.           -s _✓f_✓i_✓l_✓e
  2741.                True if _✓f_✓i_✓l_✓e exists and has a size greater than
  2742.                zero.
  2743.           -S _✓f_✓i_✓l_✓e
  2744.                True if _✓f_✓i_✓l_✓e exists and is a socket.
  2745.           -t [_✓f_✓d]
  2746.                True if _✓f_✓d is opened on a terminal.  If _✓f_✓d is
  2747.                omitted, it defaults to 1 (standard output).
  2748.           -u _✓f_✓i_✓l_✓e
  2749.                True if _✓f_✓i_✓l_✓e exists and its set-user-id bit is
  2750.                set.
  2751.           -w _✓f_✓i_✓l_✓e
  2752.                True if _✓f_✓i_✓l_✓e exists and is writable.
  2753.           -x _✓f_✓i_✓l_✓e
  2754.                True if _✓f_✓i_✓l_✓e exists and is executable.
  2755.           -O _✓f_✓i_✓l_✓e
  2756.                True if _✓f_✓i_✓l_✓e exists and is owned by the effective
  2757.                user id.
  2758.           -G _✓f_✓i_✓l_✓e
  2759.                True if _✓f_✓i_✓l_✓e exists and is owned by the effective
  2760.                group id.
  2761.           _✓f_✓i_✓l_✓e_✓1 -nt _✓f_✓i_✓l_✓e_✓2
  2762.                True if _✓f_✓i_✓l_✓e_✓1 is newer (according to modification
  2763.                date) than _✓f_✓i_✓l_✓e_✓2.
  2764.           _✓f_✓i_✓l_✓e_✓1 -ot _✓f_✓i_✓l_✓e_✓2
  2765.                True if _✓f_✓i_✓l_✓e_✓1 is older than file2.
  2766.  
  2767.  
  2768.  
  2769. Page 42                                                       GNU
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776. BASH(1)                   1991 July 15                    BASH(1)
  2777.  
  2778.  
  2779.  
  2780.           _✓f_✓i_✓l_✓e_✓1 -ef _✓f_✓i_✓l_✓e
  2781.                True if _✓f_✓i_✓l_✓e_✓1 and _✓f_✓i_✓l_✓e_✓2 have the same device and
  2782.                inode numbers.
  2783.           -z _✓s_✓t_✓r_✓i_✓n_✓g
  2784.                True if the length of _✓s_✓t_✓r_✓i_✓n_✓g is zero.
  2785.           -n _✓s_✓t_✓r_✓i_✓n_✓g
  2786.           _✓s_✓t_✓r_✓i_✓n_✓g
  2787.                True if the length of _✓s_✓t_✓r_✓i_✓n_✓g is non-zero.
  2788.           _✓s_✓t_✓r_✓i_✓n_✓g_✓1 = _✓s_✓t_✓r_✓i_✓n_✓g_✓2
  2789.                True if the strings are equal.
  2790.           _✓s_✓t_✓r_✓i_✓n_✓g_✓1 != _✓s_✓t_✓r_✓i_✓n_✓g_✓2
  2791.                True if the strings are not equal.
  2792.           ! _✓e_✓x_✓p_✓r
  2793.                True if _✓e_✓x_✓p_✓r is false.
  2794.           _✓e_✓x_✓p_✓r_✓1 -a _✓e_✓x_✓p_✓r_✓2
  2795.                True if both _✓e_✓x_✓p_✓r_✓1 AND _✓e_✓x_✓p_✓r_✓2 are true.
  2796.           _✓e_✓x_✓p_✓r_✓1 -o _✓e_✓x_✓p_✓r_✓2
  2797.                True if either _✓e_✓x_✓p_✓r_✓1 OR _✓e_✓x_✓p_✓r_✓2 is true.
  2798.           _✓a_✓r_✓g_✓1 OP _✓a_✓r_✓g_✓2
  2799.                OP is one of -eq, -ne, -lt, -le, -gt, or -ge.
  2800.                These arithmetic binary operators return true if
  2801.                _✓a_✓r_✓g_✓1 is equal, not-equal, less-than, less-than-
  2802.                or-equal, greater-than, or greater-than-or-equal
  2803.                than _✓a_✓r_✓g_✓2, respectively.  _✓A_✓r_✓g_✓1 and _✓a_✓r_✓g_✓2 may be
  2804.                positive integers, negative integers, or the spe-
  2805.                cial expression -l _✓s_✓t_✓r_✓i_✓n_✓g, which evaluates to the
  2806.                length of _✓s_✓t_✓r_✓i_✓n_✓g.
  2807.  
  2808.      times
  2809.           Print the accumulated user and system times for the
  2810.           shell and for processes run from the shell.
  2811.  
  2812.      trap [_✓a_✓r_✓g] [_✓s_✓i_✓g_✓s_✓p_✓e_✓c]
  2813.           The command _✓a_✓r_✓g is to be read and executed when the
  2814.           shell receives signal(s) _✓s_✓i_✓g_✓s_✓p_✓e_✓c.  If _✓a_✓r_✓g is absent or
  2815.           -, all specified signals are are reset to their origi-
  2816.           nal values (the values they had upon entrance to the
  2817.           shell).  If _✓a_✓r_✓g is the null string this signal is
  2818.           ignored by the shell and by the commands it invokes.
  2819.           _✓s_✓i_✓g_✓s_✓p_✓e_✓c is either a signal name in <signal.h>, or a
  2820.           signal number. If _✓s_✓i_✓g_✓s_✓p_✓e_✓c is EXIT (0) the command _✓a_✓r_✓g
  2821.           is executed on exit from the shell.  With no arguments,
  2822.           trap prints the list of commands associated with each
  2823.           signal number.  The -l option causes the shell to print
  2824.           a list of signal names and their corresponding numbers.
  2825.           An argument of -- disables option checking for the rest
  2826.           of the arguments.  Signals ignored upon entry to the
  2827.           shell cannot be trapped or reset.  Trapped signals are
  2828.           reset to their original values in a child process when
  2829.           it is created.  The return status is false if either
  2830.           then trap name or number is invalid; otherwise trap
  2831.           returns true.
  2832.  
  2833.  
  2834.  
  2835. Page 43                                                       GNU
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842. BASH(1)                   1991 July 15                    BASH(1)
  2843.  
  2844.  
  2845.  
  2846.      type [-all] [-type | -path] [_✓n_✓a_✓m_✓e ...]
  2847.           With no options, indicate how each _✓n_✓a_✓m_✓e would be inter-
  2848.           preted if used as a command name.  If the -type flag is
  2849.           used, type prints a phrase which is one of _✓a_✓l_✓i_✓a_✓s, _✓k_✓e_✓y_✓-
  2850.           _✓w_✓o_✓r_✓d, _✓f_✓u_✓n_✓c_✓t_✓i_✓o_✓n, _✓b_✓u_✓i_✓l_✓t_✓i_✓n, or _✓f_✓i_✓l_✓e if _✓n_✓a_✓m_✓e is an alias,
  2851.           shell reserved word, function, builtin, or disk file,
  2852.           respectively. If the name is not found, then nothing is
  2853.           printed, and an exit status of false is returned.  If
  2854.           the -path flag is used, type either returns the name of
  2855.           the disk file that would be executed if _✓n_✓a_✓m_✓e were
  2856.           specified as a command name, or nothing if -type would
  2857.           not return _✓f_✓i_✓l_✓e.  If a command is hashed, -path prints
  2858.           the hashed value, not necessarily the file that appears
  2859.           first in PATH.  If the -all flag is used, type prints
  2860.           all of the places that contain an executable named
  2861.           _✓n_✓a_✓m_✓e.  This includes aliases and functions, if and only
  2862.           if the -path flag is not also used.  The table of
  2863.           hashed commands is not consulted when using -all.  type
  2864.           accepts -a, -t, and -p in place of -all, -type, and
  2865.           -path, respectively.  An argument of -- disables option
  2866.           checking for the rest of the arguments.  type returns
  2867.           true if any of the arguments are found, false if none
  2868.           are found.
  2869.  
  2870.      ulimit [-SHacdfmstpn [_✓l_✓i_✓m_✓i_✓t]]
  2871.           Ulimit provides control over the resources available to
  2872.           the shell and to processes started by it, on systems
  2873.           that allow such control.  The value of _✓l_✓i_✓m_✓i_✓t can be a
  2874.           number in the unit specified for the resource, or the
  2875.           value unlimited.  The H and S options specify that the
  2876.           hard or soft limit is set for the given resource.  A
  2877.           hard limit cannot be increased once it is set; a soft
  2878.           limit may be increased up to the value of the hard
  2879.           limit.  If neither H nor S is specified, the command
  2880.           applies to the soft limit.  If _✓l_✓i_✓m_✓i_✓t is omitted, the
  2881.           current value of the soft limit of the resource is
  2882.           printed, unless the H option is given.  When more than
  2883.           one resource is specified, the limit name and unit is
  2884.           printed before the value.  Other options are inter-
  2885.           preted as follows:
  2886.           -a   all current limits are reported
  2887.           -c   the maximum size of core files created
  2888.           -d   the maximum size of a process's data segment
  2889.           -f   the maximum size of files created by the shell
  2890.           -m   the maximum resident set size
  2891.           -s   the maximum stack size
  2892.           -t   the maximum amount of cpu time in seconds
  2893.           -p   the pipe size in 512-byte blocks (this may not be
  2894.                set)
  2895.           -n   the maximum number of open file descriptors (most
  2896.                systems do not allow this value to be set, only
  2897.                displayed)
  2898.  
  2899.  
  2900.  
  2901. Page 44                                                       GNU
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908. BASH(1)                   1991 July 15                    BASH(1)
  2909.  
  2910.  
  2911.  
  2912.           An argument of -- disables option checking for the rest
  2913.           of the arguments.  If _✓l_✓i_✓m_✓i_✓t is given, it is the new
  2914.           value of the specified resource (the -a option is
  2915.           display only).  If no option is given, then -f is
  2916.           assumed.  Values are in 1024-byte increments, except
  2917.           for -t, which is in seconds, and -p, which is in units
  2918.           of 512-byte blocks.
  2919.  
  2920.      umask [-S] [_✓m_✓o_✓d_✓e]
  2921.           The user file-creation mask is set to _✓m_✓o_✓d_✓e.  If _✓m_✓o_✓d_✓e
  2922.           begins with a digit, it is interpreted as an octal
  2923.           number; otherwise it is interpreted as a symbolic mode
  2924.           mask similar to that accepted by _✓c_✓h_✓m_✓o_✓d(_✓1).  If _✓m_✓o_✓d_✓e is
  2925.           omitted, or if the -S option is supplied, the current
  2926.           value of the mask is printed.  The -S option causes the
  2927.           mask to be printed in symbolic form; the default output
  2928.           is an octal number.  An argument of -- disables option
  2929.           checking for the rest of the arguments.
  2930.  
  2931.      unalias [_✓n_✓a_✓m_✓e ...]
  2932.           Remove _✓n_✓a_✓m_✓es from the list of defined aliases.  The
  2933.           return value is true unless _✓n_✓a_✓m_✓e is not a defined
  2934.           alias.
  2935.  
  2936.      unset [-fv] [_✓n_✓a_✓m_✓e ...]
  2937.           For each _✓n_✓a_✓m_✓e, remove the corresponding variable or,
  2938.           given the -f option, function.  An argument of -- dis-
  2939.           ables option checking for the rest of the arguments.
  2940.           Note that PATH, IFS, PPID, PS1, PS2, UID, and EUID can-
  2941.           not be unset.  If any of RANDOM, SECONDS, or LINENO are
  2942.           unset, they lose their special properties, even if they
  2943.           are subsequently reset.  The exit status is true unless
  2944.           the variable _✓n_✓a_✓m_✓e does not exist or is non-unsettable.
  2945.  
  2946.      wait [_✓n]
  2947.           Wait for the specified process and report its termina-
  2948.           tion status.  _✓n may be a process ID or a job specifica-
  2949.           tion; if a job spec is given, all processes in that
  2950.           job's pipeline are waited for.  If _✓n is not given, all
  2951.           currently active child processes are waited for, and
  2952.           the return code is zero.
  2953.  
  2954. INVOCATION
  2955.      A _✓l_✓o_✓g_✓i_✓n _✓s_✓h_✓e_✓l_✓l is one whose first character of argument zero
  2956.      is a - , or one started with the -login flag.
  2957.  
  2958.      An _✓i_✓n_✓t_✓e_✓r_✓a_✓c_✓t_✓i_✓v_✓e shell is one whose standard input and output
  2959.      are both connected to terminals (as determined by
  2960.      _✓i_✓s_✓a_✓t_✓t_✓y(3)), or one started with the -i flag.  PS1 is set and
  2961.      $- includes i if bash is interactive, allowing a way to test
  2962.      this state from a shell script or a startup file.
  2963.  
  2964.  
  2965.  
  2966.  
  2967. Page 45                                                       GNU
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974. BASH(1)                   1991 July 15                    BASH(1)
  2975.  
  2976.  
  2977.  
  2978.      Login shells:
  2979.        On login:
  2980.              if /_✓e_✓t_✓c/_✓p_✓r_✓o_✓f_✓i_✓l_✓e exists, source it.
  2981.  
  2982.              if ~/._✓b_✓a_✓s_✓h__✓p_✓r_✓o_✓f_✓i_✓l_✓e exists, source it,
  2983.                else if ~/._✓b_✓a_✓s_✓h__✓l_✓o_✓g_✓i_✓n exists, source it,
  2984.                  else if ~/._✓p_✓r_✓o_✓f_✓i_✓l_✓e exists, source it.
  2985.  
  2986.        On logout:
  2987.              if ~/._✓b_✓a_✓s_✓h__✓l_✓o_✓g_✓o_✓u_✓t exists, source it.
  2988.  
  2989.      Non-login interactive shells:
  2990.        On startup:
  2991.              if ~/._✓b_✓a_✓s_✓h_✓r_✓c exists, source it.
  2992.  
  2993.      Non-interactive shells:
  2994.        On startup:
  2995.              if the environment variable ENV is non-null, expand
  2996.           it and source the file it names.
  2997.  
  2998. SEE ALSO
  2999.      _✓T_✓h_✓e _✓G_✓n_✓u _✓R_✓e_✓a_✓d_✓l_✓i_✓n_✓e _✓L_✓i_✓b_✓r_✓a_✓r_✓y, Brian Fox
  3000.      _✓T_✓h_✓e _✓G_✓n_✓u _✓H_✓i_✓s_✓t_✓o_✓r_✓y _✓L_✓i_✓b_✓r_✓a_✓r_✓y, Brian Fox
  3001. Lennert
  3002.      _✓A _✓S_✓y_✓s_✓t_✓e_✓m _✓V _✓C_✓o_✓m_✓p_✓a_✓t_✓i_✓b_✓l_✓e _✓I_✓m_✓p_✓l_✓e_✓m_✓e_✓n_✓t_✓a_✓t_✓i_✓o_✓n _✓o_✓f _✓4._✓2_✓B_✓S_✓D _✓J_✓o_✓b _✓C_✓o_✓n_✓t_✓r_✓o_✓l, David
  3003.      _✓H_✓o_✓w _✓t_✓o _✓w_✓e_✓a_✓r _✓w_✓e_✓i_✓r_✓d _✓p_✓a_✓n_✓t_✓s _✓f_✓o_✓r _✓f_✓u_✓n _✓a_✓n_✓d _✓p_✓r_✓o_✓f_✓i_✓t, Brian Fox
  3004.      _✓s_✓h(1), _✓k_✓s_✓h(1), _✓c_✓s_✓h(1)
  3005.  
  3006. FILES
  3007.      /_✓b_✓i_✓n/_✓b_✓a_✓s_✓h
  3008.           The bash executable
  3009.      /_✓e_✓t_✓c/_✓p_✓r_✓o_✓f_✓i_✓l_✓e
  3010.           The systemwide initialization file, executed for login
  3011.           shells
  3012.      ~/._✓b_✓a_✓s_✓h__✓p_✓r_✓o_✓f_✓i_✓l_✓e
  3013.           The personal initialization file, executed for login
  3014.           shells
  3015.      ~/._✓b_✓a_✓s_✓h_✓r_✓c
  3016.           The individual per-interactive-shell startup file
  3017.      ~/._✓i_✓n_✓p_✓u_✓t_✓r_✓c
  3018.           Individual _✓R_✓e_✓a_✓d_✓l_✓i_✓n_✓e initialization file
  3019.  
  3020. AUTHORS
  3021.           Brian Fox, Free Software Foundation (primary author)
  3022.           bfox@ai.MIT.Edu
  3023.  
  3024.           Chet Ramey, Case Western Reserve University
  3025.           chet@ins.CWRU.Edu
  3026.  
  3027. BUG REPORTS
  3028.      If you find a bug in bash, you should report it.  But first,
  3029.      you should make sure that it really is a bug, and that it
  3030.  
  3031.  
  3032.  
  3033. Page 46                                                       GNU
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040. BASH(1)                   1991 July 15                    BASH(1)
  3041.  
  3042.  
  3043.  
  3044.      appears in the latest version of bash that you have.
  3045.  
  3046.      Once you have determined that a bug actually exists, mail a
  3047.      bug report to _✓b_✓a_✓s_✓h-_✓m_✓a_✓i_✓n_✓t_✓a_✓i_✓n_✓e_✓r_✓s@_✓a_✓i._✓M_✓I_✓T._✓E_✓d_✓u.  If you have a
  3048.      fix, you are welcome to mail that as well!  Suggestions and
  3049.      `philosophical' bug reports may be mailed to _✓b_✓u_✓g-
  3050.      _✓b_✓a_✓s_✓h@_✓a_✓i._✓M_✓I_✓T._✓E_✓d_✓u or posted to the Usenet newsgroup
  3051.      gnu.bash.bug.
  3052.  
  3053.      ALL bug reports should include:
  3054.  
  3055.      The version number of bash
  3056.      The hardware and operating system
  3057.      The compiler used to compile
  3058.      A description of the bug behaviour
  3059.      A short script or `recipe' which exercises the bug
  3060.  
  3061.      Comments and bug reports concerning this manual page should
  3062.      be directed to _✓c_✓h_✓e_✓t@_✓i_✓n_✓s._✓C_✓W_✓R_✓U._✓E_✓d_✓u.
  3063.  
  3064. BUGS
  3065.      It's too big and too slow.
  3066.  
  3067.      There are some subtle differences between bash and tradi-
  3068.      tional versions of sh, mostly because of the POSIX specifi-
  3069.      cation.
  3070.  
  3071.      Aliases are confusing in some uses.
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099. Page 47                                                       GNU
  3100.  
  3101.  
  3102.  
  3103.